Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example creates a block of locked cells, and changes their background color.

C++

CWnd::OnCreate()
{
// Display only 4 columns and rows
m_Spread1.SetVisibleRows(4);
m_Spread1.SetVisibleCols(4);
m_Spread1.SetAutoSize(True);
// Put text in the first column
m_Spread1.SetCol(1);
m_Spread1.SetRow(1);
m_Spread1.SetText("1st Quarter");
m_Spread1.SetRow(2);
m_Spread1.SetText("2nd Quarter");
m_Spread1.SetRow(3);
m_Spread1.SetText("3rd Quarter");
m_Spread1.SetRow(4);
m_Spread1.SetText("4th Quarter");
// Set up the locked cells
m_Spread1.SetLockBackColor(0x00C0C0C0);
m_Spread1.SetCol(1);
m_Spread1.SetRow(1);
m_Spread1.SetCol2(1);
m_Spread1.SetRow2(4);
m_Spread1.SetBlockMode(True);
m_Spread1.SetLock(True);
m_Spread1.SetBlockMode(False);
m_Spread1.SetProtect(True);
}

Visual Basic

Private Sub Form_Load()
' Display only 4 columns and rows
fpSpread1.VisibleRows = 4
fpSpread1.VisibleCols = 4
fpSpread1.AutoSize = True
' Put text in the first column
fpSpread1.Col = 1
fpSpread1.Row = 1
fpSpread1.Text = "1st Quarter"
fpSpread1.Row = 2
fpSpread1.Text = "2nd Quarter"
fpSpread1.Row = 3
fpSpread1.Text = "3rd Quarter"
fpSpread1.Row = 4
fpSpread1.Text = "4th Quarter"
' Set up the locked cells
fpSpread1.LockBackColor = RGB(192, 192, 192)
fpSpread1.Col = 1
fpSpread1.Row = 1
fpSpread1.Col2 = 1
fpSpread1.Row2 = 4
fpSpread1.BlockMode = True
fpSpread1.Lock = True
fpSpread1.BlockMode = False
fpSpread1.Protect = True
End Sub

Copyright © GrapeCity, inc. All rights reserved.