The CMFCTabCtrl class provides functionality for a tab control. The tab control displays a dockable window with flat or three-dimensional tabs at its top or bottom. The tabs can display text and an image and can change color when active.
class CMFCTabCtrl : public CMFCBaseTabCtrl
Members
Public Constructors
| Name | Description | 
|---|---|
| CMFCTabCtrl::CMFCTabCtrl | Default constructor. | 
| CMFCTabCtrl::~CMFCTabCtrl | Destructor. | 
Public Methods
| Name | Description | 
|---|---|
| Displays the specified tab of the current tab control and sets the focus on that tab. | |
| 
 | |
| Specifies whether the framework is to resize the client area of all tab control windows when a user interface element of the tab control changes. | |
| Deflates the size of the specified tab area. (Overrides CMFCBaseTabCtrl::CalcRectEdit.) | |
| Creates the tab control and attaches it to the CMFCTabCtrl object. | |
| CMFCTabCtrl::CreateObject | Used by the framework to create a dynamic instance of this class type. | 
| Shows or hides a Close button (X) on the active tab. | |
| Enables or disables editable tab labels. (Overrides CMFCBaseTabCtrl::EnableInPlaceEdit.) | |
| Replaces two buttons that scroll the window tabs with a button that opens a menu of tabbed windows. | |
| Ensures that a tab is visible. | |
| Retrieves the symbol that is associated with a tab in a popup menu of tabbed windows. | |
| Retrieves the index of the first tab that is visible in the current tab control. | |
| Retrieves a value that specifies how the current tab control can be resized. | |
| Retrieves a pointer to the scroll bar object that is associated with the tab control. | |
| Retrieves the bounding rectangle of the tab label area at the top or bottom of the tab control. (Overrides CMFCBaseTabCtrl::GetTabArea.) | |
| CMFCTabCtrl::GetTabFromPoint | Retrieves the tab that contains a specified point. (Overrides CMFCBaseTabCtrl::GetTabFromPoint.) | 
| Retrieves the maximum width of a tab. | |
| Retrieves the height of the tab area of the current tab control. | |
| Retrieves a rectangle that bounds the tab area of the current tab control. (Overrides CMFCBaseTabCtrl::GetTabsRect.) | |
| CMFCTabCtrl::GetThisClass | Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type. | 
| Retrieves the boundary of the client area of the current tab control. | |
| Hides the horizontal scroll bar, if any, of the active window. | |
| Specifies whether the framework is to display inactive tab control windows. | |
| Enables or disables drawing the tab area if there are no visible tabs. | |
| Enables or disables drawing a tab when there is a single tabbed window. (Overrides CMFCBaseTabCtrl::HideSingleTab.) | |
| Indicates whether the current tab of a tab control is the active tab in an multiple document interface tab group. | |
| Indicates whether the text of the active tab is displayed using a bold font. | |
| Indicates whether the Close button (X) is displayed on an active tab or the upper-right corner of the tab area. | |
| Indicates whether the tabbed window draws a frame rectangle around embedded panes. | |
| Indicates whether the frame around the tab area is flat or 3D. | |
| Indicates whether the appearance of the tabs in the current tab control is flat or not. | |
| Indicates whether the appearance of the left and right side of a tab in the current tab control is rounded. | |
| Indicates whether the current tab control is contained in the client area of a multiple-document interface window. | |
| Indicates whether the current tab control is displayed in the style of Microsoft OneNote. | |
| CMFCTabCtrl::IsPtInTabArea | Determines if a point is inside the tab area. (Overrides CMFCBaseTabCtrl::IsPtInTabArea.) | 
| Indicates whether the current tab control has a scroll bar that can scroll its tabs as a group. | |
| Indicates whether the tab control displays scroll buttons or a button that displays a menu of tabbed windows. | |
| Indicates whether tabs are displayed in the style of Visual Studio .NET 2005. | |
| Specifies the appearance of tabs in the current tab control. | |
| CMFCTabCtrl::MoveTab | Moves a tab to another tab position. (Overrides CMFCBaseTabCtrl::MoveTab.) | 
| Called by the framework when the cursor is first dragged into the tab control window. | |
| Called by the framework during a drag operation when the mouse is moved over the drop target window. (Overrides CMFCBaseTabCtrl::OnDragOver.) | |
| Displays a popup menu of tabbed windows, waits until the user selects a tab, and makes the selected tab the active tab. | |
| CMFCTabCtrl::PreTranslateMessage | Translates window messages before they are dispatched to the TranslateMessage and DispatchMessage Windows functions. (Overrides CMFCBaseTabCtrl::PreTranslateMessage.) | 
| CMFCTabCtrl::RecalcLayout | Recalculates the internal layout of the tab control. (Overrides CMFCBaseTabCtrl::RecalcLayout.) | 
| Sets the current tab of a tab control as the active tab in an multiple document interface tab group. | |
| Activates a tab. (Overrides CMFCBaseTabCtrl::SetActiveTab.) | |
| Enables or disables use of a bold font on active tabs. | |
| Enables or disables drawinga frame rectangle around an embedded bar. | |
| Specifies whether to draw a flat or a 3D frame around the tab area. | |
| Specifies an image list. (Overrides CMFCBaseTabCtrl::SetImageList.) | |
| Specifies how the current tab control can be resized and then redisplays the control. | |
| Specifies the maximum tab width in a tabbed window. | |
| Terminates the current resize operation on the tab control. | |
| CMFCTabCtrl::SwapTabs | Swaps a pair of tabs. (Overrides CMFCBaseTabCtrl::SwapTabs.) | 
| Draws a horizontal scroll bar on a tab control that displays flat tabs. | 
Data Members
| Name | Description | 
|---|---|
| Prevents the active view from losing focus when a new tab is inserted and enabled. | 
Remarks
The CMFCTabCtrl class supports:
- Tab control styles that include 3D, flat, and flat with a shared horizontal scroll bar. 
- Tabs located at the top or the bottom of the window. 
- Tabs that display text, images, or text and images. 
- Tabs that change color when the tab is active. 
- Border size changes for adjustable tabs. 
- Detachable tabbed windows. 
The CMFCTabCtrl class can be used with a dialog box, but is intended for applications that use docking control bars like Microsoft Excel and Visual Studio. For more information, see CDockablePane Class.
Follow these steps to add a resizable, docking tab control in your application:
- Create an instance of CTabbedPane Class. 
- Call CDockablePane::Create. 
- Use CBaseTabbedPane::AddTab or CMFCBaseTabCtrl::InsertTab to add new tabs. 
- Call CBasePane::EnableDocking so that the current docking tab control can dock at the main frame window. 
- Call CFrameWndEx::DockPane to dock the tabbed window at the main frame. 
For an example of how to create a tabbed window as a docking control bar, see CTabbedPane Class. To use CMFCTabCtrl as a non-docking control, create a CMFCTabCtrl object and then call CMFCTabCtrl::Create.
Inheritance Hierarchy
Example
The following example demonstrates how to use various methods in the CMFCTabCtrl class to configure a CMFCTabCtrl object. The example explains how to add a tab, show the Close button on the active tab, enable editable tab labels, and display a pop-up menu of tabbed window labels. This example is part of the State Collection sample.
    CMFCTabCtrl m_wndTabs;
...
    // Attach list windows to tab:
    // CListCtrl m_wndList1
    // CListCtrl m_wndList2
    // CListCtrl m_wndList3
    m_wndTabs.AddTab (&m_wndList1, _T("Output 1"), (UINT)-1);
    m_wndTabs.AddTab (&m_wndList2, _T("Output 2"), (UINT)-1);
    m_wndTabs.AddTab (&m_wndList3, _T("Output 3"), (UINT)-1);
    m_wndTabs.EnableActiveTabCloseButton();
    m_wndTabs.EnableInPlaceEdit(true);
    m_wndTabs.EnableTabDocumentsMenu();
    m_wndTabs.SetActiveTab(1);
    m_wndTabs.SetDrawFrame();
    m_wndTabs.SetFlatFrame();
Requirements
Header: afxtabctrl.h