CMFCBaseVisualManager Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CMFCBaseVisualManager Class.

A layer between derived visual managers and the Windows Theme API.

CMFCBaseVisualManager loads UxTheme.dll, if available, and manages access to Windows Theme API methods.

This class is for internal use only.

class CMFCBaseVisualManager: public CObject  

Public Constructors

NameDescription
CMFCBaseVisualManager::CMFCBaseVisualManagerConstructs and initializes a CMFCBaseVisualManager object.
CMFCBaseVisualManager::~CMFCBaseVisualManagerDestructor.

Public Methods

NameDescription
CMFCBaseVisualManager::DrawCheckBoxDraws a check box control by using the current Windows theme.
CMFCBaseVisualManager::DrawComboBorderDraws a combo box border using the current Windows theme.
CMFCBaseVisualManager::DrawComboDropButtonDraws a combo box drop-down button using the current Windows theme.
CMFCBaseVisualManager::DrawPushButtonDraws a push button using the current Windows theme.
CMFCBaseVisualManager::DrawRadioButtonDraws a radio button control by using the current Windows theme.
CMFCBaseVisualManager::DrawStatusBarProgressDraws a progress bar on a status bar control ( CMFCStatusBar Class) using the current Windows theme.
CMFCBaseVisualManager::FillReBarPaneFills the background of the rebar control by using the current Windows theme.
CMFCBaseVisualManager::GetStandardWindowsThemeGets the current Windows theme.

Protected Methods

NameDescription
CMFCBaseVisualManager::CleanUpThemesCalls CloseThemeData for all handles obtained in UpdateSystemColors.
CMFCBaseVisualManager::UpdateSystemColorsCalls OpenThemeData to obtain handles for drawing various controls: windows, toolbars, buttons, and so on.

You do not have to instantiate objects of this class directly.

Because it is a base class for all visual managers, you can just call CMFCVisualManager::GetInstance, obtain a pointer to the current Visual Manager, and access the methods for CMFCBaseVisualManager using that pointer. However, if you have to display a control by using the current Windows theme, it is better to use the CMFCVisualManagerWindows interface.

CObject

CMFCBaseVisualManager

Header: afxvisualmanager.h

Calls CloseThemeData for all handles obtained in UpdateSystemColors.

void CleanUpThemes();

Remarks

For internal use only.

Constructs and initializes a CMFCBaseVisualManager object.

CMFCBaseVisualManager();

Draws a check box control by using the current Windows theme.

virtual BOOL DrawCheckBox(
    CDC* pDC,   
    CRect rect,   
    BOOL bHighlighted,   
    int nState,   
    BOOL bEnabled,   
    BOOL bPressed);

);

Parameters

[in] pDC
A pointer to a device context

[in] rect
The bounding rectangle of the check box.

[in] bHighlighted
Specifies whether the check box is highlighted.

[in] nState
0 for unchecked, 1 for checked normal,

2 for mixed normal.

[in] bEnabled
Specifies whether the check box is enabled.

[in] bPressed
Specifies whether the check box is pressed.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

Remarks

The values of nState correspond to the following check box styles.

nStateCheck box style
0CBS_UNCHECKEDNORMAL
1CBS_CHECKEDNORMAL
2CBS_MIXEDNORMAL

Draws the combo box border using the current Windows theme.

virtual BOOL DrawComboBorder(
    CDC* pDC,   
    CRect rect,   
    BOOL bDisabled,   
    BOOL bIsDropped,   
    BOOL bIsHighlighted);

Parameters

[in] pDC
A pointer to a device context.

[in] rect
Bounding rectangle of the combo box border.

[in] bDisabled
Specifies whether the combo box border is disabled.

[in] bIsDropped
Specifies whether the combo box border is dropped down.

[in] bIsHighlighted
Specifies whether the combo box border is highlighted.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

Draws a combo box drop-down button using the current Windows theme.

virtual BOOL DrawComboDropButton(
    CDC* pDC,   
    CRect rect,   
    BOOL bDisabled,   
    BOOL bIsDropped,   
    BOOL bIsHighlighted);

Parameters

ParameterDescription
[in] pDCA pointer to a device context.
[in] rectThe bounding rectangle of the combo box drop-down button.
[in] bDisabledSpecifies whether the combo box drop-down button is disabled.
[in] bIsDroppedSpecifies whether the combo box drop-down button is dropped down.
[in] bIsHighlightedSpecifies whether the combo box drop-down button is highlighted.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

Draws a push button using the current Windows theme.

virtual BOOL DrawPushButton(
    CDC* pDC,   
    CRect rect,   
    CMFCButton* pButton,   
    UINT uiState);

Parameters

[in] pDC
A pointer to a device context.

[in] rect
The bounding rectangle of the push button.

[in] pButton
A pointer to the CMFCButton Class object to draw.

[in] uiState
Ignored. The state is taken from pButton.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

Draws a radio button control by using the current Windows theme.

virtual BOOL DrawRadioButton(
    CDC* pDC,   
    CRect rect,   
    BOOL bHighlighted,   
    BOOL bChecked,   
    BOOL bEnabled,   
    BOOL bPressed);

Parameters

[in] pDC
A pointer to a device context.

[in] rect
The bounding rectangle of the radio button.

[in] bHighlighted
Specifies whether the radio button is highlighted.

[in] bChecked
Specifies whether the radio button is checked.

[in] bEnabled
Specifies whether the radio button is enabled.

[in] bPressed
Specifies whether the radio button is pressed.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

Draws progress bar on status bar control ( CMFCStatusBar Class) using the current Windows theme.

virtual BOOL DrawStatusBarProgress(
    CDC* pDC,   
    CMFCStatusBar* pStatusBar,   
    CRect rectProgress,   
    int nProgressTotal,   
    int nProgressCurr,  
    COLORREF clrBar,   
    COLORREF clrProgressBarDest,   
    COLORREF clrProgressText,   
    BOOL bProgressText);

Parameters

[in] pDC
A pointer to a device context.

[in] pStatusBar
A pointer to status bar. This value is ignored.

[in] rectProgress
The bounding rectangle of the progress bar in pDC coordinates.

[in] nProgressTotal
The total progress value.

[in] nProgressCurr
The current progress value.

[in] clrBar
The start color. CMFCBaseVisualManager ignores this. Derived classes can use it for color gradients.

[in] clrProgressBarDest
The end color. CMFCBaseVisualManager ignores this. Derived classes can use it for color gradients.

[in] clrProgressText
Progress text color. CMFCBaseVisualManager ignores this. The text color is defined by afxGlobalData.clrBtnText.

[in] bProgressText
Specifies whether to display progress text.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

Fills the background of the rebar control by using the current Windows theme.

virtual void FillReBarPane(
    CDC* pDC,   
    CBasePane* pBar,   
    CRect rectClient);

Parameters

[in] pDC
A pointer to a device context.

[in] pBar
A pointer to a pane whose background should be drawn.

[in] rectClient
The bounding rectangle of the area to be filled.

Return Value

TRUE if Theme API is enabled; otherwise FALSE.

Gets the current Windows theme.

virtual WinXpTheme GetStandardWindowsTheme();

Return Value

The currently selected Windows Theme color. Can be one of the following enumerated values:

  • WinXpTheme_None - there is no theme enabled.

  • WinXpTheme_NonStandard - non standard theme is selected (meaning a theme is selected, but none from the list below).

  • WinXpTheme_Blue - blue theme (Luna).

  • WinXpTheme_Olive - olive theme.

  • WinXpTheme_Silver - silver theme.

Calls OpenThemeData to obtain handles for drawing various controls: windows, toolbars, buttons, and so on.

void UpdateSystemColors();

Remarks

For internal use only.

Hierarchy Chart
Classes

Show: