<< Return to Main Index

< Return to Class Index

CGXStylesMap::GetBaseStyleId

WORD GetBaseStyleId(LPCTSTR pszName) const;

WORD GetBaseStyleId(UINT nResourceID) const;

pszName

Specifies the base-style name.

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.  If the base-style does not exist, 0 will be returned. You should then make sure the base style is registered by calling RegisterStyle

Remarks

Returns the base-style id for the specified style.

The style must have been registered with RegisterStyle before. The value returned by this method is the same as RegisterStyle returns.

To apply base styles to cells you first have to get an id for the base style.

Example:

   m_wStyleCombo = GetParam()->GetStylesMap()->GetBaseStyleId(szComboStyle);
   m_wStyleError = GetParam()->GetStylesMap()->GetBaseStyleId(szErrorStyle);

      SetStyleRange(
         CGXRange(5,2,8,3),
         CGXStyle()
            .SetBaseStyle(m_wStyleCombo)
            .SetValue(_T("one"))
         );

      SetStyleRange(
         CGXRange(5,4,8,5),
         CGXStyle()
            .SetBaseStyle(m_wStyleError)
            .SetValue(_T("ALERT!"))
         );

See Also

CGXStylesMap::RegisterStyle CGXGridCore::BaseStyle CGXStyle::SetBaseStyle

CGXStylesMap

Class Overview | Class Members