-
Understanding FormatStyles [Janus GridEX WinForms Control v3.5 for .NET]
GridEXFormatStyle class allows developers to specify appearance settings to be used for drawing the different areas in a GridEX control, having the possibility to inherit values from the GridEXFormatStyle defined in the owner of the area.
Before a grid area is drawn, GridEX control inspects the format style of an area to get colors and fonts that will be used. If a setting in the format style is empty, the control inspects the format style defined for the type of the area in the owner object.
For instance, to draw a cell, the sequence of GridEXFormatStyle objects used to get its appearance properties is as follows:
1) GridEXCell.FormatStyle (if it is set in the FormattingRow event)
2) GridEXColumn.CellStyle
3) GridEXRow.RowStyle (if it is set in the FormattingRow event)
4) GridEXTable.AlternatingRowStyle (if AlternatingColors is true)
5) GridEXTable.RowStyle
6) GridEXRow.AlternatingRowStyle (if AlternatingColors is true)
7) GridEX.RowStyle
Following this sequence, to get the background color of a cell, the FormatStyle property in the GridEXCell instance representing the cell is used. If the FormatStyle property is not set or the BackColor property is equal to Color.Empty, the GridEXFormatStyle returned by the CellStyle property in the GridEXColumn that owns the cell is used. The control will continue searching through the sequence until the BackColor property of one of the GridEXFormatStyle in it is defined.
This allows you to change appearance properties to all cells in general using the RowFormatStyle property in the GridEX control while letting you define a specific format for a cell using the FormatStyle property in the GridEXCell object.
Other areas in GridEX control are drawn using format styles too. Below, you can see a table with the some of the areas GridEX control has and the sequence of GridEXFormatStyle objects used to get their appearance properties.
Grid Area
Format styles used
Cell
GridEXCell.FormatStyle (Set in the FormattingRow event)
GridEXColumn.CellStyle
GridEXRow.RowStyle (Set in the FormattingRow event)
GridEXTable.AlternatingRowStyle (if AlternatingColors is true)
GridEXTable.RowStyle
GridEX.AlternatingRowStyle (if AlternatingColors is true)
GridEX.RowStyle
Row Header
GridEXTable.HeaderFormatStyle
GridEX.HeaderFormatStyle
Column Header (table view)
GridEXColumn.HeaderStyle
GridEXTable.HeaderFormatStyle
GridEX.HeaderFormatStyle
Column Header (card and single card views)
GridEXColumn.HeaderStyle
GridEX.CardColumnHeaderStyle
GridEX.RowStyle
ColumnSet Header
GridEXColumnSet.HeaderStyle
GridEXTable.HeaderFormatStyle
GridEX.HeaderFormatStyle
Card Caption Bar
GridEX.SelectedFormatStyle (if it is selected)
GridEX.CardCaptionFormatStyle
Group By Box
GridEX.GroupByBoxFormatStyle
Group By Box Info Text
GridEX.GroupByBoxInfoFormatStyle
Group Row*
GridEXRow.RowStyle (Set in the FormattingRow event)
GridEXColumn.GroupRowStyle
GridEXTable.GroupRowFormatStyle
GridEX.GroupRowFormatStyle
Group Total Row
GridEXRow.RowStyle (Set in the FormattingRow event)
GridEXColumn.GroupRowStyle
GridEXTable.GroupTotalRowFormatStyle
GridEX.GroupTotalRowFormatStyle
GridEXTable.GroupRowFormatStyle
GridEX.GroupRowFormatStyle
*Remarks: An Outlook 2003 look can be achieved in Group Rows using the GroupRowVisualStyle Property.
Cells in GridEX control also can use format styles defined in a GridEXFormatCondition . If the row a cell belongs meets the criteria defined in the format condition, the settings you specify in the FormatStyle for that condition are going to be applied to the cell.
Some of the properties in the GridEXFormatStyle have their default values defined as property in the GridEX control. For instance, when none of the format styles in a sequence have a Font defined, the Font property of the control is used.
Other properties that can get their default values from the GridEX control are:Alpha
If Alpha is -1 in all the format styles in a sequence, the value defined in the DefaultAlphaLevel property of the GridEX control is used.
BackColorAlphaMode
If BackColorAlphaMode is AlphaMode.Empty in all the format styles in a sequence, the value defined in the DefaultBackColorAlphaMode property of the GridEX control is used. If this property is also AlphaMode.Empty, the value of the DefaultAlphaMode property will be used.
ForeColorAlphaMode
If ForeColorAlphaMode is AlphaMode.Empty in all the format styles in a sequence, the value defined in the DefaultForeColorAlphaMode property of the GridEX control is used. If this property is also AlphaMode.Empty, the value of the DefaultAlphaMode property will be used.
Blend
If Blend is -1 in all the format styles in a sequence, the value defined in the DefaultBlend property of the GridEX control is used.
This behavior allows you to define transparency in all the areas of a GridEX control by setting just one or two properties instead of setting these properties in all the format styles GridEX control uses. For instance, to use an alpha of 120 in the background of all the areas of the control you just need to set the DefaultBackColorAlphaMode property to AlphaMode.UseAlpha and the DefaultAlphaLevel property to 120.
Remarks: By default the control paints certain areas with a “Themed” appearance when running under Windows XP and its FormatStyle is ignored. In order to apply the settings defined in a FormatStyle when running under Windows XP, the ThemedAreas Property for those areas must be unchecked.
GridEX also features the VisualStyle property in which an appearance patterned after Office 2003 and 2007 or VS 2005 can be used to paint the control. A FormatStyle can be applied to an area even when a VisualStyle is used if the ThemedAreas for such element is unchecked, otherwise when running under Windows XP the colors will be taken from the Visual Style defined in the machine. For the VisualStyle Office2007, you can specify the color scheme of the VisualStyle using the Office2007ColorScheme property that lets you choose between Blue, Silver, Black or Custom color schemes. For Custom color scheme, you can specify the color to use as the base color with the Office2007CustomColor property.
The new VisualStyleManager component is provided for all Janus controls. With a VisualStyleManager, you can define one or more color schemes. In each ColorScheme, you can define whether theme colors are used or not and which VisualStyle to use in the controls associated to the VisualStyleManager. To change the appearance of all the controls managed by the component, you can change the DefaultColorScheme property to the name of one of the ColorSchemes defined for in the component.
VisualStyleManager also contains the static properties DefaultOffice2007ColorScheme and DefaultOffice2007CustomColor properties that you can use to change the color scheme of all Janus controls in the application using VisualStyle.Office2007. For this to work, the controls must have its Office2007ColorScheme property set to Default.
Source Of Information : Janus v3.5 Help Files for VS 2008
0 comments: