Specifies themes styles and appearance of controls in Dapfor library

Classes

  ClassDescription
Public classGridRenderer
Renders Grid UI elements
Public classGridXPRenderer
Draws dapfor controls using XP/Vista/Win7 styles
Public classRoundButtonRenderer
Draws the RoundButton with the selected style.
Public classTheme
The theme defines style and appearance of controls in Dapfor library
Public classTheme..::..ThemeEditor
Theme editor
Public classThemeRenderer
Default Theme renderer

Interfaces

  InterfaceDescription
Public interfaceIGridRenderer
Provides an appearance and methods to draw .Net Grid with selected style.
Public interfaceIRoundButtonRenderer
Provides an appearance and methods to draw RoundButton with selected style.
Public interfaceIThemeRenderer
Provides renderers to draw various dapfor's controls

Enumerations

  EnumerationDescription
Public enumerationKnownTheme
Specifies predefined themes

Remarks

Themes are sets of properties and colors for each control. They define style and appearance of controls in Dapfor library. In addition to properties and cooler themes contain code for specific painting of various control elements (including .Net Grid).

The grid supports attachment of themes via Grid.Theme property. Dapfor's library contains several predefined themes such as Theme.XPStyle, Theme.Silver, etc. The list of predefined themes is stored in Dapfor.Net.Theming.KnownTheme enumeration. Accordingly, theme object can be obtained with the following code.

 Copy imageCopy
grid1.Theme = Theme.XPStyle;
grid2.Theme = Theme.FromKnownTheme(KnownTheme.XPStyle);

A programmer may also create his own themes, including those based on already existing themes. The example below demonstrates creation of an arbitrary theme on the basis of an existing theme. Therefore, all grids using the same theme shall look in the same way.

 Copy imageCopy
Theme myTheme = new Theme("MyTheme", Theme.Silver);
myTheme.Renderers.GridRenderer.Appearance.ColumnNormal.BackColor = Color.LightPink;
myTheme.Renderers.GridRenderer.Appearance.ColumnNormal.GradientEndBackColor = ControlPaint.Dark(Color.LightPink);
grid.Theme = myTheme;

Dapfor�s library provides a convenient API for theme changing. For this purpose it uses a special default theme that is returned by Theme.Default property. If a grid uses this theme, it subscribes to Theme.DefaultThemeChanged events. Therefore, when a new theme is set in Theme.Default property, all controls subscribed to this theme shall receive notifications and automatically change their appearance.

 Copy imageCopy
grid1.Theme = Theme.Default;
grid2.Theme = Theme.Default;

Theme myTheme = new Theme("MyTheme", Theme.Silver);
Theme.Default = myTheme;

Grid themes have been developed to enable the programmer to change appearance of any grid elements. When a theme is set for the grid, this grid uses colors and renderer defined for each theme. In addition to that a programmer may modify colors for headers, columns, rows etc using properties like Grid.Appearance, Header.Appearance, etc.