Skip to content

BackColor Property

Description

The background color of the GridRecordItem.

Property Type

Read-write property

Syntax (Visual Basic)

Public Property BackColor() As ULong

Remarks

This property returns or sets the BackColor of the GridRecordItem. You can assign an RGB value, a Hex value, or a Visual Basic constant to this property. By default, the value is -1, which will cause the GridRecordItem to use the BackColor of the GridControl.

Example

Setting the BackColor of a GridRecordItem (Visual Basic)

This sample illustrates how to change the BackColor of a GridRecordItem at runtime and when the item is created.

Dim Record As GridRecord  
Dim Item As GridRecordItem  

' Adds a record/row to the GridControl  
Set Record = wndGridControl.Records.Add  
    Set Item = Record.AddItem("")  
        Item.HasCheckbox = True  
        Item.Checked = False  
    Set Item = Record.AddItem("RE: Your Invoice")  
        ' Sets the BackColor to a shade of grey using the RGB function  
        ' This is how the BackColor is set when the GridRecordItem is created  
        ' This will change the BackColor of "RE: Your Invoice" to grey.  
        Item.BackColor = RGB(178, 180, 191)  
        ' Sets the ForeColor to a shade of red using the Hexadecimal value for red  
        ' This is how the ForeColor is set when the GridRecordItem is created  
        ' This will change the text color of "RE: Your Invoice" to red.  
        Item.ForeColor = &HFF  
    Record.AddItem "John Smith"  
    Record.AddItem "19/06/2004"  
    Record.AddItem "18k"  

' Add the record/row to the GridControl  
wndGridControl.Populate  

' This code will change the BackColor of the 3rd GridRecordItem in the  
' 1st GridRecord/Row at runtime. This will change the text color of "John Smith" to yellow  
' and the BackColor to blue.  
wndGridControl.Records(0).Item(2).BackColor = vbBlue  
wndGridControl.Records(0).Item(2).ForeColor = vbYellow

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.