CGXStylesMap::RegisterStyle

WORD RegisterStyle(LPCTSTR pszName, const CGXStyle& style, BOOL bSystemStyle = FALSE);

WORD RegisterStyle(UINT nResourceId, const CGXStyle& style, BOOL bSystemStyle = FALSE);

pszName

Specifies the base-style name.

style

A reference to the base style to be added.

bSystemStyle

Specifies if the base style is removable (FALSE) or non-removable (TRUE).

nResourceId

A string resource id where the string resource contains the base-style name.

Return Value

The base-style id. You can use this id in CGXStyle::SetBaseStyle.

Remarks

Adds a base style to the styles-map.

If you want the user to able to change the style and write changes to profile/registry, you should call RegisterStyle before ReadProfile.

See the example for how to register a base style.

Example

This example shows you how to register a base style:

      CGXStylesMap* stylesmap = new CGXStylesMap;
      // standard styles
      stylesmap->CreateStandardStyles();
      // Additional base styles
      stylesmap->RegisterStyle(szErrorStyle,
         CGXStyle()
            .SetTextColor(RGB(255,255,0)) // yellow
            .SetInterior(RGB(255,0,0)) // red
            .SetFont(
               CGXFont()
                  .SetBold(TRUE)
               ),
         TRUE // system-style (non removable)
      );
      // user attributes
      // load profile/registry settings
      stylesmap->SetSection("My base styles");
      stylesmap->ReadProfile();
      // attach object to parameter-object
      GetParam()->SetStylesMap(stylesmap);

See Also

 CGXStylesMap::RemoveStyle  CGXStylesMap::IsSystemStyle  CGXGridCore::BaseStyle  CGXStyle::SetBaseStyle

CGXStylesMap

 Class Overview |  Class Members