Referenced By      Properties       Methods Send us your Feedback
SGStyleConditions Object

Name: SGStyleConditions
Description: Collection of SGStyleCondition objects.
GUID: {28D20E79-4F3A-11D3-B75C-008048E27A77}

Remarks

Each SGStyleCondition in the collection can be accessed by its index.

Use the Add method to add SGStyleCondition object to the collection:


   SGGrid1.CellStyleConditions.Add "Heading", sgConditionCellValue, sgOpRegEx, "^a"

 Show Example
 Copy Code     Show Me

The following example fills the grid array with random numbers and creates a StyleCondition for each possible cell value. To try the example, place BeeGrid on a form. Paste the code into the Declarations section and press F5.

Private Sub SGGrid1_OnInit()
   Dim sStyleName As String
   Dim i As Long, j As Long
   Dim ar As SGArray
   
   SGGrid1.RedrawEnabled = False
   SGGrid1.GroupByBoxVisible = False
   'create cols and rows
   SGGrid1.DataRowCount = 20
   SGGrid1.DataColCount = 3
   'create 256 styles
   For i = 0 To 255
      sStyleName = "Style" & Trim$(i)
      With SGGrid1.Styles.Add(sStyleName)
         .CopyFrom SGGrid1.Styles("Normal")
         .BackColor = RGB(255 - i, 255 - i, 255 - i)
         .ForeColor = RGB(255, i, 0)
         .Font.Bold = True
      End With
      'add new style in the StyleConditions collection
      SGGrid1.CellStyleConditions.Add _
         sStyleName, sgConditionCellValue, sgOpEqual, i
   Next
   
   Set ar = SGGrid1.Array
   'add test data
   For i = 0 To SGGrid1.DataRowCount - 1
      For j = 0 To SGGrid1.DataColCount - 1
         ar.Value(i, j) = CLng(Rnd * 255)
      Next
   Next
   
   SGGrid1.RedrawEnabled = True
End Sub



Back to topic

Referenced By

SGColumn.StyleConditions | CellStyleConditions