Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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 CMFCAutoHideButton Class.
A button that displays or hides a CDockablePane Class that is configured to hide.
Syntax
class CMFCAutoHideButton : public CObject
Members
Public Methods
Name | Description |
---|---|
CMFCAutoHideButton::BringToTop | |
CMFCAutoHideButton::Create | Creates and initializes the auto-hide button. |
CMFCAutoHideButton::GetAlignment | Retrieves the alignment of the auto-hide button. |
CMFCAutoHideButton::GetAutoHideWindow | Returns the CDockablePane object associated with the auto-hide button. |
CMFCAutoHideButton::GetParentToolBar | |
CMFCAutoHideButton::GetRect | |
CMFCAutoHideButton::GetSize | Determines the size of the auto-hide button. |
CMFCAutoHideButton::GetTextSize | Returns the size of the text label for the auto-hide button. |
CMFCAutoHideButton::HighlightButton | Highlights auto hide button. |
CMFCAutoHideButton::IsActive | Indicates whether the auto-hide button is active. |
CMFCAutoHideButton::IsHighlighted | Returns highlight state of auto hide button. |
CMFCAutoHideButton::IsHorizontal | Determines whether the auto-hide button is horizontal or vertical. |
CMFCAutoHideButton::IsTop | |
CMFCAutoHideButton::IsVisible | Indicates whether the button is visible. |
CMFCAutoHideButton::Move | |
CMFCAutoHideButton::OnDraw | The framework calls this method when it draws the auto-hide button. |
CMFCAutoHideButton::OnDrawBorder | The framework calls this method when it draws the border of an auto-hide button. |
CMFCAutoHideButton::OnFillBackground | The framework calls this method when it fills the background of an auto-hide button. |
CMFCAutoHideButton::ReplacePane | |
CMFCAutoHideButton::ShowAttachedWindow | Shows or hides the associated CDockablePane Class. |
CMFCAutoHideButton::ShowButton | Shows or hides the auto-hide button. |
CMFCAutoHideButton::UnSetAutoHideMode |
Remarks
On creation, the CMFCAutoHideButton
object is attached to a CDockablePane Class. The CDockablePane
object is hidden or displayed as the user interacts with the CMFCAutoHideButton
object.
By default, the framework automatically creates a CMFCAutoHideButton
when the user turns on auto-hide. The framework can create an element of a custom UI class instead of the CMFCAutoHideButton
class. To specify which custom UI class the framework should use, set the static member variable CMFCAutoHideBar::m_pAutoHideButtonRTS
equal to the custom UI class. By default, this variable is set to CMFCAutoHideButton
.
Example
The following example demonstrates how to construct a CMFCAutoHideButton
object and use various methods in the CMFCAutoHideButton
class. The example shows how to initialize a CMFCAutoHideButton
object by using its Create
method, show the associated CDockablePane
class, and show the auto-hide button.
CMFCAutoHideButton* autoHideButton = new CMFCAutoHideButton();
CDockablePane cPane;
// CMFCAutoHideBar* pParentBar
if ( !autoHideButton->Create(pParentBar, &cPane, CBRS_ALIGN_LEFT) )
{
return 0;
}
autoHideButton->ShowAttachedWindow(true);
autoHideButton->ShowButton(true);
Inheritance Hierarchy
Requirements
Header: afxautohidebutton.h
CMFCAutoHideButton::BringToTop
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
void BringToTop();
Remarks
CMFCAutoHideButton::Create
Creates and initializes an auto-hide button.
virtual BOOL Create(
CMFCAutoHideBar* pParentBar,
CDockablePane* pAutoHideWnd,
DWORD dwAlignment);
Parameters
[in] pParentBar
A pointer to the parent toolbar.
[in] pAutoHideWnd
A pointer to a CDockablePane object. This auto-hide button hides and shows that CDockablePane
.
[in] dwAlignment
A value that specifies the alignment of the button with the main frame window.
Return Value
Nonzero if successful; otherwise 0.
Remarks
When you create a CMFCAutoHideButton object, you must associate the auto-hide button with a specific CDockablePane
. The user can use the auto-hide button to hide and show the associated CDockablePane
.
The dwAlignment
parameter indicates where the auto-hide button resides in the application. The parameter can be any one of the following values:
CBRS_ALIGN_LEFT
CBRS_ALIGN_RIGHT
CBRS_ALIGN_TOP
CBRS_ALIGN_BOTTOM
CMFCAutoHideButton::GetAlignment
Retrieves the alignment of the auto-hide button.
DWORD GetAlignment() const;
Return Value
A DWORD
value that contains the current alignment of the auto-hide button.
Remarks
The alignment of the auto-hide button indicates where the button resides on the application. It can be any one of the following values:
CBRS_ALIGN_LEFT
CBRS_ALIGN_RIGHT
CRBS_ALIGN_TOP
CBRS_ALIGN_BOTTOM
CMFCAutoHideButton::GetAutoHideWindow
Returns the CDockablePane object associated with the auto-hide button.
CDockablePane* GetAutoHideWindow() const;
Return Value
A pointer to the associated CDockablePane
object.
Remarks
To associate an auto-hide button with a CDockablePane
, pass the CDockablePane
as a parameter to the CMFCAutoHideButton::Create method.
CMFCAutoHideButton::GetParentToolBar
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
CMFCAutoHideBar* GetParentToolBar();
Return Value
Remarks
CMFCAutoHideButton::GetRect
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
CRect GetRect() const;
Return Value
Remarks
CMFCAutoHideButton::GetSize
Determines the size of the auto-hide button.
CSize GetSize() const;
Return Value
A CSize
object that contains the button size.
Remarks
The calculated size includes the size of the border of the auto-hide button.
CMFCAutoHideButton::GetTextSize
Returns the size of the text label for the auto-hide button.
virtual CSize GetTextSize() const;
Return Value
A CSize object that contains the size of the text for the auto-hide button.
CMFCAutoHideButton::IsActive
Indicates whether the auto-hide button is active.
BOOL IsActive() const;
Return Value
TRUE
if the auto-hide button is active; FALSE
otherwise.
Remarks
An auto-hide button is active when the associated CDockablePane Class window is shown.
CMFCAutoHideButton::IsHorizontal
Determines whether the auto-hide button is horizontal or vertical.
BOOL IsHorizontal() const;
Return Value
Nonzero if the button is horizontal; 0 otherwise.
Remarks
The framework sets the orientation of a CMFCAutoHideButton object when you create it. You can control the orientation by using the dwAlignment
parameter in the CMFCAutoHideButton::Create method.
CMFCAutoHideButton::IsTop
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
BOOL IsTop() const;
Return Value
Remarks
CMFCAutoHideButton::IsVisible
Indicates whether the auto-hide button is visible.
virtual BOOL IsVisible() const;
Return Value
TRUE
if the button is visible; FALSE
otherwise.
CMFCAutoHideButton::OnDraw
The framework calls this method when it draws the auto-hide button.
virtual void OnDraw(CDC* pDC);
Parameters
[in] pDC
A pointer to a device context.
Remarks
If you want to customize the appearance of auto-hide buttons in your application, create a new class derived from the CMFCAutoHideButton Class. In your derived class, override this method.
CMFCAutoHideButton::OnDrawBorder
The framework calls this method when it draws the border of an auto-hide button.
virtual void OnDrawBorder(
CDC* pDC,
CRect rectBounds,
CRect rectBorderSize);
Parameters
[in] pDC
A pointer to a device context.
[in] rectBounds
The bounding rectangle of the auto-hide button.
[in] rectBorderSize
The border thickness for each side of the auto-hide button.
Remarks
If you want to customize the border of each auto-hide button in your application, create a new class derived from the CMFCAutoHideButton Class. In your derived class, override this method.
CMFCAutoHideButton::OnFillBackground
The framework calls this method when it fills the background of an auto-hide button.
virtual void OnFillBackground(
CDC* pDC,
CRect rect);
Parameters
[in] pDC
A pointer to a device context.
[in] rect
The bounding rectangle of the auto-hide button.
Remarks
If you want to customize the background for auto-hide buttons in your application, create a new class derived from the CMFCAutoHideButton Class. In your derived class, override this method.
CMFCAutoHideButton::ShowAttachedWindow
Shows or hides the associated CDockablePane Class.
void ShowAttachedWindow(BOOL bShow);
Parameters
[in] bShow
A Boolean that specifies whether this method shows the attached CDockablePane
.
CMFCAutoHideButton::ShowButton
Shows or hides the auto-hide button.
virtual void ShowButton(BOOL bShow);
Parameters
[in] bShow
A Boolean that specifies whether to show the auto-hide button.
CMFCAutoHideButton::Move
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
void Move(int nOffset);
Parameters
[in] nOffset
Remarks
CMFCAutoHideButton::ReplacePane
This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
void ReplacePane(CDockablePane* pNewBar);
Parameters
[in] pNewBar
Remarks
CMFCAutoHideButton::UnSetAutoHideMode
Disable auto-hide mode.
virtual void UnSetAutoHideMode(CDockablePane* pFirstBarInGroup);
Parameters
[in] pFirstBarInGroup
A pointer to the first bar in the group.
Remarks
CMFCAutoHideButton::HighlightButton
Highlights the auto hide button.
virtual void HighlightButton(BOOL bHighlight);
Parameters
bHighlight
Specifies the new auto hide button state. TRUE
indicates the button is highlighted, FALSE
indicates the button is not highlighted.
Remarks
CMFCAutoHideButton::IsHighlighted
Returns the highlight state of the auto hide button.
virtual BOOL IsHighlighted() const;
Return Value
Returns TRUE
if the auto hide button is highlighted; otherwise FALSE
.
Remarks
See Also
Hierarchy Chart
Classes
CMFCAutoHideBar Class
CAutoHideDockSite Class