The folloving example cahanges cells back and fore color. To try the example, place BeeGrid on a form. Paste the code into the Declarations section and press F5.
Private Sub SGGrid1_OnInit()
Dim ar As Variant
Dim i%, j%, k%
Dim lRow As Long
Dim oCell As SGCell
With SGGrid1
'disable grid redrawing
.RedrawEnabled = False
'hide GroupByBox
.GroupByBoxVisible = False
'set grid's appearance
.Font.Name = "Symbol"
.TextAlignment = sgAlignCenterCenter
.Styles("CurrentRow").Font.Name = "Symbol"
'create and customize rows
'and columns
.Columns.RemoveAll True
.DefaultColWidth = 300
.DefaultRowHeight = 300
.HeadingColCount = 0
.HeadingRowCount = 0
.DataRowCount = 49
.DataColCount = 7
End With
'use SGCell object to load data and
'custimize cells styles
ar = Array(0, 64, 96, 128, 192, 224, 255)
For i = 0 To 6
For j = 0 To 6
For k = 0 To 6
Set oCell = SGGrid1.Rows.At(lRow).Cells(k)
oCell.Style.BackColor = RGB(ar(k), ar(j), ar(i))
oCell.Style.ForeColor = RGB(ar(i), ar(k), ar(j))
oCell.Value = Chr(&HAA)
Next
lRow = lRow + 1
Next
Next
'enable grid repainting
SGGrid1.RedrawEnabled = True
End Sub
Back to topic