|
|
Title | Align and color cells in a FlexGrid control |
Description | This example shows how to align and color cells in a FlexGrid control in Visual Basic 6. |
Keywords | FlexGrid, align, cell, color |
Categories | Controls |
|
|
Use the control's Row, Col, and Text properties to examine the values. Use the CellForeColor property to change the colors when appropriate. Use the CellAlignment property to set a cell's alignment.
|
|
Private Sub Data1_Reposition()
Dim i As Integer
For i = 1 To MSFlexGrid1.Rows - 1
MSFlexGrid1.Row = i
MSFlexGrid1.Col = 2
If CCur(MSFlexGrid1.Text) > 100 Then
MSFlexGrid1.CellForeColor = vbRed
End If
MSFlexGrid1.Col = 3
If IsNumeric(MSFlexGrid1.Text) Then
MSFlexGrid1.CellAlignment = flexAlignRightCenter
End If
Next i
MSFlexGrid1.Col = 0
MSFlexGrid1.Row = 0
MSFlexGrid1.ColWidth(0) = 240
MSFlexGrid1.ColWidth(1) = 1440
MSFlexGrid1.ColWidth(2) = 1440
MSFlexGrid1.ColWidth(3) = 1440
End Sub
|
|
|
|
|
|