Compartir a través de


CMFCRibbonCheckBox Class

 

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

The CMFCRibbonCheckBox class implements a check box that you can add to a ribbon panel, Quick Access Toolbar, or popup menu.

Syntax

class CMFCRibbonCheckBox : public CMFCRibbonButton  

Members

Public Constructors

Name Description
CMFCRibbonCheckBox::CMFCRibbonCheckBox The constructor.

Public Methods

Name Description
CMFCRibbonCheckBox::GetCompactSize (Overrides CMFCRibbonButton::GetCompactSize.)
CMFCRibbonCheckBox::GetIntermediateSize (Overrides CMFCRibbonButton::GetIntermediateSize.)
CMFCRibbonCheckBox::GetRegularSize (Overrides CMFCRibbonButton::GetRegularSize.)
CMFCRibbonCheckBox::IsDrawTooltipImage (Overrides CMFCRibbonButton::IsDrawTooltipImage.)
CMFCRibbonCheckBox::OnDraw (Overrides CMFCRibbonButton::OnDraw.)
CMFCRibbonCheckBox::OnDrawMenuImage (Overrides CMFCRibbonBaseElement::OnDrawMenuImage.)
CMFCRibbonCheckBox::OnDrawOnList (Overrides CMFCRibbonButton::OnDrawOnList.)
CMFCRibbonCheckBox::SetACCData (Overrides CMFCRibbonButton::SetACCData.)

Remarks

To use a CMFCRibbonCheckBox in your application, add the following constructor to your code:

CMFCRibbonCheckBox (UINT nID, LPCTSTR lpszText)  

where nID is the check box command ID and lpszText is the text label of the check box.

You can add a check box to a ribbon panel by using CMFCRibbonPanel::Add.

Inheritance Hierarchy

CObject

CMFCRibbonBaseElement

CMFCRibbonButton

CMFCRibbonCheckBox

Requirements

Header: afxribboncheckbox.h

CMFCRibbonCheckBox::CMFCRibbonCheckBox

Constructor of a ribbon check box object

CMFCRibbonCheckBox(
    UINT nID,  
    LPCTSTR lpszText);

Parameters

[in] nID
Specifies command ID.

[in] lpszText
Specifies text label.

Return Value

Constructs a ribbon check box object.

Example

The following example demonstrates how to construct an object of the CMFCRibbonCheckBox class.

 strTemp.LoadString(IDS_RIBBON_STATUSBAR);
    CMFCRibbonButton* pBtnStatusBar = new CMFCRibbonCheckBox(ID_VIEW_STATUS_BAR, strTemp);

CMFCRibbonCheckBox::GetCompactSize

When overridden, gets the compact size of the checkbox.

virtual CSize GetCompactSize(CDC* pDC);

Parameters

[in] pDC
Pointer to the CDC associated with the checkbox.

Return Value

Returns a CSize object that contains the compact size of the checkbox.

Remarks

If not overridden, returns the intermediate size of the checkbox.

CMFCRibbonCheckBox::GetIntermediateSize

Gets the intermediate size of the checkbox.

virtual CSize GetIntermediateSize(CDC* pDC);

Parameters

[in] pDC
Pointer to the CDC associated with this checkbox.

Return Value

A CSize object containing the intermediate size of the checkbox.

Remarks

If not overridden, calculates the intermediate size as the default checkbox size ( AFX_CHECK_BOX_DEFAULT_SIZE) plus the text size, plus margins.

CMFCRibbonCheckBox::GetRegularSize

Gets the regular size of the checkbox.

virtual CSize GetRegularSize(CDC* pDC);

Parameters

[in] pDC
Pointer to the CDC object associated with this checkbox.

Return Value

Returns a CSize object that contains the regular size of the checkbox.

Remarks

If not overridden, returns the intermediate size of the checkbox.

CMFCRibbonCheckBox::IsDrawTooltipImage

Indicates whether there is a tooltip image associated with the checkbox.

virtual BOOL IsDrawTooltipImage() const;  

Return Value

Returns TRUE if there is a tooltip image associated with the checkbox, or FALSE if not.

Remarks

CMFCRibbonCheckBox::OnDraw

Called by the framework to draw the checkbox using a specified device context.

virtual void OnDraw(CDC* pDC);

Parameters

[in] pDC
Pointer to the CDC in which to draw the checkbox.

Remarks

CMFCRibbonCheckBox::OnDrawMenuImage

Called by the framework to draw a menu image for the checkbox.

virtual BOOL OnDrawMenuImage(CDC*, CRect);

Parameters

[in] CDC*
Pointer to the CDC associated with the checkbox.

[in] CRect
A CRect object specifying the rectangle in which to draw the menu image.

Return Value

Returns TRUE if the image was drawn, or FALSE if not.

Remarks

If not overridden, returns FALSE.

CMFCRibbonCheckBox::OnDrawOnList

Called by the framework to draw the checkbox in a commands list box.

virtual void OnDrawOnList(
    CDC* pDC,  
    CString strText,  
    int nTextOffset,  
    CRect rect,  
    BOOL bIsSelected,  
    BOOL bHighlighted);

Parameters

[in] pDC
Pointer to the device context in which to draw the checkbox.

[in] strText
The display text.

[in] nTextOffset
The distance, in pixels, from the left side of the list box to the display text.

[in] rect
The display rectangle for the checkbox.

[in] bIsSelected
TRUE if the checkbox is selected, or FALSE if not.

[in] bHighlighted
TRUE if the checkbox is highlighted, or FALSE if not.

Remarks

CMFCRibbonCheckBox::SetACCData

Sets the accessibility data for the checkbox.

virtual BOOL SetACCData(
    CWnd* pParent,  
    CAccessibilityData& data);

Parameters

pParent
The parent window of the checkbox.

data
The accessibility data for the checkbox.

Return Value

Always returns TRUE.

Remarks

By default this method sets the accessibility data for the checkbox and always returns TRUE. Override this method to set the accessibility data and return a value that indicates success or failure.

See Also

Hierarchy Chart
Classes
CMFCRibbonPanel Class