description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: CMFCRibbonCheckBox Class |
CMFCRibbonCheckBox Class |
11/04/2016 |
|
|
3a6c3891-c8d1-4af0-b954-7b9ab048782a |
The CMFCRibbonCheckBox
class implements a check box that you can add to a ribbon panel, Quick Access Toolbar, or popup menu.
class CMFCRibbonCheckBox : public CMFCRibbonButton
Name | Description |
---|---|
CMFCRibbonCheckBox::CMFCRibbonCheckBox | The constructor. |
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.) |
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.
Header: afxribboncheckbox.h
Constructor of a ribbon check box object
CMFCRibbonCheckBox(
UINT nID,
LPCTSTR lpszText);
nID
[in] Specifies command ID.
lpszText
[in] Specifies text label.
Constructs a ribbon check box object.
The following example demonstrates how to construct an object of the CMFCRibbonCheckBox
class.
[!code-cppNVC_MFC_RibbonApp#17]
When overridden, gets the compact size of the check box.
virtual CSize GetCompactSize(CDC* pDC);
pDC
[in] Pointer to the CDC associated with the check box.
Returns a CSize
object that contains the compact size of the check box.
If not overridden, returns the intermediate size of the check box.
Gets the intermediate size of the check box.
virtual CSize GetIntermediateSize(CDC* pDC);
pDC
[in] Pointer to the CDC associated with this check box.
A CSize
object containing the intermediate size of the check box.
If not overridden, calculates the intermediate size as the default check box size ( AFX_CHECK_BOX_DEFAULT_SIZE
) plus the text size, plus margins.
Gets the regular size of the check box.
virtual CSize GetRegularSize(CDC* pDC);
pDC
[in] Pointer to the CDC object associated with this check box.
Returns a CSize
object that contains the regular size of the check box.
If not overridden, returns the intermediate size of the check box.
Indicates whether there is a tooltip image associated with the check box.
virtual BOOL IsDrawTooltipImage() const;
Returns TRUE if there is a tooltip image associated with the check box, or FALSE if not.
Called by the framework to draw the check box using a specified device context.
virtual void OnDraw(CDC* pDC);
pDC
[in] Pointer to the CDC in which to draw the check box.
Called by the framework to draw a menu image for the check box.
virtual BOOL OnDrawMenuImage(CDC*, CRect);
[in] CDC*
Pointer to the CDC associated with the check box.
CRect
[in] A CRect
object specifying the rectangle in which to draw the menu image.
Returns TRUE if the image was drawn, or FALSE if not.
If not overridden, returns FALSE.
Called by the framework to draw the check box in a commands list box.
virtual void OnDrawOnList(
CDC* pDC,
CString strText,
int nTextOffset,
CRect rect,
BOOL bIsSelected,
BOOL bHighlighted);
pDC
[in] Pointer to the device context in which to draw the check box.
strText
[in] The display text.
nTextOffset
[in] The distance, in pixels, from the left side of the list box to the display text.
rect
[in] The display rectangle for the check box.
bIsSelected
[in] TRUE if the check box is selected, or FALSE if not.
bHighlighted
[in] TRUE if the check box is highlighted, or FALSE if not.
Sets the accessibility data for the check box.
virtual BOOL SetACCData(
CWnd* pParent,
CAccessibilityData& data);
pParent
The parent window of the check box.
data
The accessibility data for the check box.
Always returns TRUE.
By default this method sets the accessibility data for the check box and always returns TRUE. Override this method to set the accessibility data and return a value that indicates success or failure.