See Also Send us your Feedback
BeeGrid Basics - Working With Styles

The BeeGrid uses a style model to simplify customization of grid's appearance. BeeGrid styles are organized in a Style hierarchy with the "Normal" style in the hierarchy root. Following list shows predefined styles and their relationship.

   

Normal Root of the style hierarchy. Attributes of this style are applied when no other style defines particular attribute.
   Heading Applied to the row and column headings.
      Caption Applied to the grid caption.
   Selection Applied to the selection.
      InactiveSelection Applied to the selection when grid doesn't have input focus.
   CurrentRow Applied to all cells in a current row.
   CurrentCell Applied to the current cell.
   FilteredRow Applied to the filtered row.
   FrozenRow Applied to the frozen row.
   GroupHeader Applied to the group headers.
   GroupFooter Applied to the group footers.
   Tip Applied to the cell and scroll tips.
   PreviewPane Applied to the preview pane.
   GroupByBox Applied to the group-by box.
   GroupByBoxCell Applied to cells inside the group-by box.
   GridBackground Applied to the grid background.

    

Each SGStyle object encapsulates  appearance attributes such as a font, picture, color, Alpha blending or formatting. Style hierarchy enables attribute inheritance, so for example, if color is not initialized in one style, it is inherited from a parent style. 

When BeeGrid draws a particular cell it uses styles applied to that cell to determine its appearance. This is a list that defines the order in which styles are applied.

  1. Grid's "Normal" style.

  2. Style from the row's Style property

  3. Style from the column's Style property.

  4. Conditional styles from the RowStyleConditions collection. Styles are applied in their collection order. 

  5. Conditional styles from the StyleConditions collection. Styles are applied in their collection order.

  6. Conditional styles from the CellStyleConditions collection. Styles are applied in their collection order.

  7. If cell is a member of the group header or footer row, "GroupHeader" or "GroupFooter" styles are applied.

  8. If cell is a row or column heading, "HeadingStyle" is applied.

  9. If cell is a column heading cell, style from the column's HeadingStyle property

  10. If cell is a row heading cell, style from the first column's Style property.

  11. Style from the cell's Style property.

  12. Even/odd row colors.

 

You can create your own styles with the Add method of the SGStyles collection.


Dim sty As SGStyle

Set sty = SGGrid1.Styles.Add("MyStyle")

To access style from the Styles collection use its name. For example, to access the "Normal" style use following syntax:

Dim sty As SGStyle 

Set sty = SGGrid.Styles("Normal")

To save and load style definitions use the GetDefinition and SetDefinition methods of the SGStyles collection.

See Also

Styles | Tutorial - Using Styles | Samples - Appearance | Samples - Styles | Samples - Built-in Styles