Spread Windows Forms 10.0 Product Documentation
LockBackColor Property (Cell)
Example 


Gets or sets the background color for a locked cell.
Syntax
'Declaration
 
Public Property LockBackColor As Color
'Usage
 
Dim instance As Cell
Dim value As Color
 
instance.LockBackColor = value
 
value = instance.LockBackColor
public Color LockBackColor {get; set;}
Example
This example sets the LockBackColor property.
fpSpread1.ActiveSheet.Cells[1, 1].LockBackColor = Color.Tomato;
fpSpread1.ActiveSheet.Cells[1, 1].LockForeColor = Color.DarkBlue;
fpSpread1.ActiveSheet.Cells[1, 1].LockFont = new Font("Calibri", 11);
fpSpread1.ActiveSheet.Cells[1, 1].Text = "Locked";
fpSpread1.ActiveSheet.Cells[1, 1].Locked = true;

fpSpread1.ActiveSheet.Columns[3].LockBackColor = Color.Bisque;
fpSpread1.ActiveSheet.Columns[3].LockForeColor = Color.DarkBlue;
fpSpread1.ActiveSheet.Columns[3].LockFont = new Font("Calibri", 11);
fpSpread1.ActiveSheet.Cells[0, 3, 10, 3].Text = "Locked";
fpSpread1.ActiveSheet.Columns[3].Locked = true;

fpSpread1.ActiveSheet.Rows[3].LockBackColor = Color.LemonChiffon;
fpSpread1.ActiveSheet.Rows[3].LockForeColor = Color.DarkBlue;
fpSpread1.ActiveSheet.Rows[3].LockFont = new Font("Calibri", 11);
fpSpread1.ActiveSheet.Cells[3, 0, 3, 10].Text = "Locked";
fpSpread1.ActiveSheet.Rows[3].Locked = true;

FarPoint.Win.Spread.NamedStyle style = new FarPoint.Win.Spread.NamedStyle();
style.Locked = true;
style.LockBackColor = Color.Beige;
style.LockForeColor = Color.Black;
style.LockFont = new Font("Calibri", 11);
style.Name = "lockstyle";
fpSpread1.ActiveSheet.Cells[5, 5].Text = "Locked";
fpSpread1.NamedStyles.Add(style);
fpSpread1.ActiveSheet.Cells[5, 5].StyleName = "lockstyle";

//fpSpread1.ActiveSheet.Cells[1, 1].ResetLockBackColor();
//fpSpread1.ActiveSheet.Columns[3].ResetLockBackColor();
//fpSpread1.ActiveSheet.Rows[3].ResetLockBackColor();
//style.ResetLockBackColor();
//fpSpread1.ActiveSheet.Cells[1, 1].ResetLockForeColor();
//fpSpread1.ActiveSheet.Columns[3].ResetLockForeColor();
//fpSpread1.ActiveSheet.Rows[3].ResetLockForeColor();
//style.ResetLockForeColor();
//fpSpread1.ActiveSheet.Cells[1, 1].ResetLockFont();
//fpSpread1.ActiveSheet.Columns[3].ResetLockFont();
//fpSpread1.ActiveSheet.Rows[3].ResetLockFont();
//style.ResetLockFont();
FpSpread1.ActiveSheet.Cells(1, 1).LockBackColor = Color.Tomato
FpSpread1.ActiveSheet.Cells(1, 1).LockForeColor = Color.DarkBlue
FpSpread1.ActiveSheet.Cells(1, 1).LockFont = New Font("Calibri", 11)
FpSpread1.ActiveSheet.Cells(1, 1).Text = "Locked"
FpSpread1.ActiveSheet.Cells(1, 1).Locked = True

FpSpread1.ActiveSheet.Columns(3).LockBackColor = Color.Bisque
FpSpread1.ActiveSheet.Columns(3).LockForeColor = Color.DarkBlue
FpSpread1.ActiveSheet.Columns(3).LockFont = New Font("Calibri", 11)
FpSpread1.ActiveSheet.Cells(0, 3, 10, 3).Text = "Locked"
FpSpread1.ActiveSheet.Columns(3).Locked = True

FpSpread1.ActiveSheet.Rows(3).LockBackColor = Color.LemonChiffon
FpSpread1.ActiveSheet.Rows(3).LockForeColor = Color.DarkBlue
FpSpread1.ActiveSheet.Rows(3).LockFont = New Font("Calibri", 11)
FpSpread1.ActiveSheet.Cells(3, 0, 3, 10).Text = "Locked"
FpSpread1.ActiveSheet.Rows(3).Locked = True

Dim style = New FarPoint.Win.Spread.NamedStyle()
style.Locked = True
style.LockBackColor = Color.Beige
style.LockForeColor = Color.Black
style.LockFont = New Font("Calibri", 11)
style.Name = "lockstyle"
FpSpread1.ActiveSheet.Cells(5, 5).Text = "Locked"
FpSpread1.NamedStyles.Add(style)
FpSpread1.ActiveSheet.Cells(5, 5).StyleName = "lockstyle"

'FpSpread1.ActiveSheet.Cells(1, 1).ResetLockBackColor()
'FpSpread1.ActiveSheet.Columns(3).ResetLockBackColor()
'FpSpread1.ActiveSheet.Rows(3).ResetLockBackColor()
'style.ResetLockBackColor()
'FpSpread1.ActiveSheet.Cells(1, 1).ResetLockForeColor()
'FpSpread1.ActiveSheet.Columns(3).ResetLockForeColor()
'FpSpread1.ActiveSheet.Rows(3).ResetLockForeColor()
'style.ResetLockForeColor()
'FpSpread1.ActiveSheet.Cells(1, 1).ResetLockFont()
'FpSpread1.ActiveSheet.Columns(3).ResetLockFont()
'FpSpread1.ActiveSheet.Rows(3).ResetLockFont()
'style.ResetLockFont()
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

Cell Class
Cell Members

 

 


Copyright © GrapeCity, inc. All rights reserved.