FlexGrid for WinForms | ComponentOne
C1.Win.C1FlexGrid Namespace / CellRange Structure / Style Property
Example

In This Topic
    Style Property (CellRange)
    In This Topic
    Gets or sets the style used to display every cell in the range.
    Syntax
    'Declaration
     
    
    Public Property Style As CellStyle
    public CellStyle Style {get; set;}
    Remarks
    Getting or setting the range style ensures that every cell in the range has the same style. If the range does not contain any cells with custom styles, this property returns null.
    Example
    The code below creates a CellRange structure and uses it to apply a custom style to the entire range.
    // create a style
    CellStyle cs = _flex.Styles.Add("red");
    cs.BackColor = Color.Red;
                
    // create a cell range and assign it a style
    CellRange rg = _flex.GetCellRange(1, 1, 5, 5);
    rg.Style = cs;
    See Also