CMFCTabCtrl Class

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

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  

Public Constructors

NameDescription
CMFCTabCtrl::CMFCTabCtrlDefault constructor.
CMFCTabCtrl::~CMFCTabCtrlDestructor.

Public Methods

NameDescription
CMFCTabCtrl::ActivateMDITabDisplays the specified tab of the current tab control and sets the focus on that tab.
CMFCTabCtrl::AllowDestroyEmptyTabbedPane
CMFCTabCtrl::AutoSizeWindowSpecifies whether the framework is to resize the client area of all tab control windows when a user interface element of the tab control changes.
CMFCTabCtrl::CalcRectEditDeflates the size of the specified tab area. (Overrides CMFCBaseTabCtrl::CalcRectEdit.)
CMFCTabCtrl::CreateCreates the tab control and attaches it to the CMFCTabCtrl object.
CMFCTabCtrl::CreateObjectUsed by the framework to create a dynamic instance of this class type.
CMFCTabCtrl::EnableActiveTabCloseButtonShows or hides a Close button ( X) on the active tab.
CMFCTabCtrl::EnableInPlaceEditEnables or disables editable tab labels. (Overrides CMFCBaseTabCtrl::EnableInPlaceEdit.)
CMFCTabCtrl::EnableTabDocumentsMenuReplaces two buttons that scroll the window tabs with a button that opens a menu of tabbed windows.
CMFCTabCtrl::EnsureVisibleEnsures that a tab is visible.
CMFCTabCtrl::GetDocumentIconRetrieves the symbol that is associated with a tab in a popup menu of tabbed windows.
CMFCTabCtrl::GetFirstVisibleTabNumRetrieves the index of the first tab that is visible in the current tab control.
CMFCTabCtrl::GetResizeModeRetrieves a value that specifies how the current tab control can be resized.
CMFCTabCtrl::GetScrollBarRetrieves a pointer to the scroll bar object that is associated with the tab control.
CMFCTabCtrl::GetTabAreaRetrieves the bounding rectangle of the tab label area at the top or bottom of the tab control. (Overrides CMFCBaseTabCtrl::GetTabArea.)
CMFCTabCtrl::GetTabFromPointRetrieves the tab that contains a specified point. (Overrides CMFCBaseTabCtrl::GetTabFromPoint.)
CMFCTabCtrl::GetTabMaxWidthRetrieves the maximum width of a tab.
CMFCTabCtrl::GetTabsHeightRetrieves the height of the tab area of the current tab control.
CMFCTabCtrl::GetTabsRectRetrieves a rectangle that bounds the tab area of the current tab control. (Overrides CMFCBaseTabCtrl::GetTabsRect.)
CMFCTabCtrl::GetThisClassUsed by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.
CMFCTabCtrl::GetWndAreaRetrieves the boundary of the client area of the current tab control.
CMFCTabCtrl::HideActiveWindowHorzScrollBarHides the horizontal scroll bar, if any, of the active window.
CMFCTabCtrl::HideInactiveWindowSpecifies whether the framework is to display inactive tab control windows.
CMFCTabCtrl::HideNoTabsEnables or disables drawing the tab area if there are no visible tabs.
CMFCTabCtrl::HideSingleTabEnables or disables drawing a tab when there is a single tabbed window. (Overrides CMFCBaseTabCtrl::HideSingleTab.)
CMFCTabCtrl::IsActiveInMDITabGroupIndicates whether the current tab of a tab control is the active tab in an multiple document interface tab group.
CMFCTabCtrl::IsActiveTabBoldFontIndicates whether the text of the active tab is displayed using a bold font.
CMFCTabCtrl::IsActiveTabCloseButtonIndicates whether the Close button ( X) is displayed on an active tab or the upper-right corner of the tab area.
CMFCTabCtrl::IsDrawFrameIndicates whether the tabbed window draws a frame rectangle around embedded panes.
CMFCTabCtrl::IsFlatFrameIndicates whether the frame around the tab area is flat or 3D.
CMFCTabCtrl::IsFlatTabIndicates whether the appearance of the tabs in the current tab control is flat or not.
CMFCTabCtrl::IsLeftRightRoundedIndicates whether the appearance of the left and right side of a tab in the current tab control is rounded.
CMFCTabCtrl::IsMDITabGroupIndicates whether the current tab control is contained in the client area of a multiple-document interface window.
CMFCTabCtrl::IsOneNoteStyleIndicates whether the current tab control is displayed in the style of Microsoft OneNote.
CMFCTabCtrl::IsPtInTabAreaDetermines if a point is inside the tab area. (Overrides CMFCBaseTabCtrl::IsPtInTabArea.)
CMFCTabCtrl::IsSharedScrollIndicates whether the current tab control has a scroll bar that can scroll its tabs as a group.
CMFCTabCtrl::IsTabDocumentsMenuIndicates whether the tab control displays scroll buttons or a button that displays a menu of tabbed windows.
CMFCTabCtrl::IsVS2005StyleIndicates whether tabs are displayed in the style of Visual Studio .NET 2005.
CMFCTabCtrl::ModifyTabStyleSpecifies the appearance of tabs in the current tab control.
CMFCTabCtrl::MoveTabMoves a tab to another tab position. (Overrides CMFCBaseTabCtrl::MoveTab.)
CMFCTabCtrl::OnDragEnterCalled by the framework when the cursor is first dragged into the tab control window.
CMFCTabCtrl::OnDragOverCalled by the framework during a drag operation when the mouse is moved over the drop target window. (Overrides CMFCBaseTabCtrl::OnDragOver.)
CMFCTabCtrl::OnShowTabDocumentsMenuDisplays a popup menu of tabbed windows, waits until the user selects a tab, and makes the selected tab the active tab.
CMFCTabCtrl::PreTranslateMessageTranslates window messages before they are dispatched to the TranslateMessage and DispatchMessage Windows functions. (Overrides CMFCBaseTabCtrl::PreTranslateMessage.)
CMFCTabCtrl::RecalcLayoutRecalculates the internal layout of the tab control. (Overrides CMFCBaseTabCtrl::RecalcLayout.)
CMFCTabCtrl::SetActiveInMDITabGroupSets the current tab of a tab control as the active tab in an multiple document interface tab group.
CMFCTabCtrl::SetActiveTabActivates a tab. (Overrides CMFCBaseTabCtrl::SetActiveTab.)
CMFCTabCtrl::SetActiveTabBoldFontEnables or disables use of a bold font on active tabs.
CMFCTabCtrl::SetDrawFrameEnables or disables drawinga frame rectangle around an embedded bar.
CMFCTabCtrl::SetFlatFrameSpecifies whether to draw a flat or a 3D frame around the tab area.
CMFCTabCtrl::SetImageListSpecifies an image list. (Overrides CMFCBaseTabCtrl::SetImageList.)
CMFCTabCtrl::SetResizeModeSpecifies how the current tab control can be resized and then redisplays the control.
CMFCTabCtrl::SetTabMaxWidthSpecifies the maximum tab width in a tabbed window.
CMFCTabCtrl::StopResizeTerminates the current resize operation on the tab control.
CMFCTabCtrl::SwapTabsSwaps a pair of tabs. (Overrides CMFCBaseTabCtrl::SwapTabs.)
CMFCTabCtrl::SynchronizeScrollBarDraws a horizontal scroll bar on a tab control that displays flat tabs.

Data Members

NameDescription
CMFCTabCtrl::m_bEnableActivatePrevents the active view from losing focus when a new tab is inserted and enabled.

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:

  1. Create an instance of CTabbedPane Class.

  2. Call CDockablePane::Create.

  3. Use CBaseTabbedPane::AddTab or CMFCBaseTabCtrl::InsertTab to add new tabs.

  4. Call CBasePane::EnableDocking so that the current docking tab control can dock at the main frame window.

  5. 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.

CObject

CCmdTarget

CWnd

CMFCBaseTabCtrl

CMFCTabCtrl

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();

Header: afxtabctrl.h

Displays the specified tab of the current tab control and sets the focus on that tab.

void ActivateMDITab(int nTab = -1);

Parameters

[in] nTab
The zero-based index of a tab to display, or -1 to specify the currently active tab.

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.

virtual BOOL AllowDestroyEmptyTabbedPane() const;

 

Return Value

Always TRUE.

Remarks

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.

void AutoSizeWindow(BOOL bAutoSize = TRUE);

Parameters

[in] bAutoSize
TRUE to automatically resize tab control windows; otherwise, FALSE. The default value is TRUE.

Remarks

Creates the tab control and attaches it to the CMFCTabCtrl object.

BOOL Create(
    Style style,  
    const RECT& rect,  
    CWnd* pParentWnd,  
    UINT nID,  
    Location location=LOCATION_BOTTOM,  
    BOOL bCloseBtn=FALSE);

Parameters

[in] style
The style of the tab control. For more information, see Remarks.

[in] rect
A rectangle that bounds the tab control.

[in] pParentWnd
A pointer to a parent window. Must not be NULL.

[in] nID
The ID of the tab control.

[in] location
The location of tabs. The default value is LOCATION_BOTTOM. For more information, see Remarks.

[in] bCloseBtn
TRUE to display a close button on the tab; otherwise, FALSE. The default value is FALSE.

Return Value

TRUE if successful; otherwise, FALSE.

Remarks

The following table describes the values you can specify for the style parameter.

StyleDescription
STYLE_3DCreates a tab control with a three-dimensional appearance.
STYLE_FLATCreates a tab control with flat tabs.
STYLE_FLAT_SHARED_HORZ_SCROLLCreates a tab control with flat tabs and a scroll bar that can scroll the tabs if they are clipped by a parent window.
STYLE_3D_ONENOTECreates a tab control in the style of Microsoft OneNote.
STYLE_3D_VS2005Creates a tab control in the style of Microsoft Visual Studio 2005.
STYLE_3D_ROUNDEDCreates a tab control with rounded tabs in the style of Microsoft Visual Studio 2005.
STYLE_3D_ROUNDED_SCROLLCreates a tab control with rounded tabs and scroll buttons in the style of Microsoft Visual Studio 2005.

The following table lists the values you can specify for the location parameter.

LocationDescription
LOCATION_BOTTOMTabs are located at the bottom of the tab control.
LOCATION_TOPTabs are located at the top of the tab control.

Example

The following example demonstrates how to use the Create method in the CMFCTabCtrl class. This example is part of the State Collection sample.

	CMFCTabCtrl	m_wndTabs;

	// Create tabs window:
	// CRect rectDummy
	// this is a pointer to a parent window
	// fourth parameter is the id of the tab control
	if (!m_wndTabs.Create (CMFCTabCtrl::STYLE_FLAT, rectDummy, this, 1))
	{
		TRACE0("Failed to create output tab window\n");
		return -1;      // fail to create
	}

Deflates the size of the specified tab area.

virtual void CalcRectEdit(CRect& rectEdit);

Parameters

[in] rectEdit
A rectangle that specifies the area of a tab.

Remarks

This method is called when you change the label of a tab. This method deflates the left and right sides of the specified rectangle by one-half the current tab height, and deflates the top and bottom by one unit.

Shows or hides a Close button ( X) on the active tab.

void EnableActiveTabCloseButton(BOOL bEnable=TRUE);

Parameters

[in] bEnable
TRUE to display the Close button on the active tab; FALSE to display the Close button on the upper-right corner of the tab area. The default value is TRUE.

Enables or disables editable tab labels.

virtual void EnableInPlaceEdit(BOOL bEnable);

Parameters

[in] bEnable
TRUE to enable editable tab labels; FALSE to disable editable tab labels.

Remarks

Toggles between a user interface that uses two buttons to scroll the window tabs and an interface that displays a pop-up menu of tabbed windows.

void EnableTabDocumentsMenu(BOOL bEnable=TRUE);

Parameters

[in] bEnable
TRUE to display a pop-up menu of tabbed window labels; FALSE to display forward and backward scroll buttons. The default value is TRUE.

Remarks

When the user clicks a tab label, the framework displays the corresponding tabbed window. If the tab label is visible, the tabbed window is opened without changing its position. If the user selects a document from the pop-up menu and the corresponding tabbed window is off screen, the tabbed window becomes the first tab.

Ensures that a tab is visible.

virtual BOOL EnsureVisible(int iTab);

Parameters

[in] iTab
The zero-based index of a tab.

Return Value

TRUE if it is successful; FALSE if the iTab parameter index is invalid.

Remarks

Use this method to guarantee that the specified tab is visible. The tab control will scroll if it is required.

Retrieves the image that is associated with a tab in a pop-up menu of tabbed windows.

static HICON __stdcall GetDocumentIcon(UINT nCmdID);

Parameters

[in] nCmdID
The command ID of a tab in a pop-up menu of tabbed windows.

Return Value

The handle of a bitmap image.

Retrieves the index of the first tab that is visible in the current tab control.

virtual int GetFirstVisibleTabNum() const;

 

Return Value

The zero-based index of a tab in the tab control.

Remarks

Use this method only when the tab control is displayed in the style of Microsoft OneNote. Use the CMFCTabCtrl::IsOneNoteStyle method to determine the style.

Retrieves a value that specifies how the current tab control can be resized.

ResizeMode GetResizeMode() const;

 

Return Value

One of the CMFCTabCtrl::ResizeMode enumeration values that specifies how the tab control can be resized. For a list of possible values, see the Remarks section of the CMFCTabCtrl::SetResizeMode method.

Retrieves a pointer to the scroll bar object that is associated with the tab control.

CScrollBar* GetScrollBar();

Return Value

A pointer to a scrollbar object, or a NULL if the tab control was not created by using the STYLE_FLAT_SHARED_HORZ_SCROLL style.

Remarks

Use this method to access the tab control's embedded scroll bar. A scroll bar object is created only when the tab control has the STYLE_FLAT_SHARED_HORZ_SCROLL style.

Retrieves the bounding rectangle of the tab label area at the top or bottom of the tab control.

void GetTabArea(
    CRect& rectTabAreaTop,  
    CRect& rectTabAreaBottom) const;

 

Parameters

[out] rectTabAreaTop
When this method returns, this reference contains a rectangle that bounds the top tab label area. The rectangle is in client coordinates. This reference is empty if no tab label area exists at the top of the tab control.

[out] rectTabAreaBottom
When this method returns, this reference contains a rectangle that bounds the bottom tab label area. The rectangle is in client coordinates. This reference is empty if no tab label area exists at the bottom of the tab control.

Remarks

Use this method to determine the size and position of the tab area in the tabbed window.

Retrieves the maximum width of a tab.

int GetTabMaxWidth() const;

 

Return Value

Maximum width of a tab, in pixels. If the return value is 0, the tab width is unlimited.

Remarks

Use the CMFCTabCtrl::SetTabMaxWidth method to set maximum tab width.

Retrieves the height of the tab area of the current tab control.

virtual int GetTabsHeight() const;

 

Return Value

The height of the tab area if any tab is visible, or zero if no tab is visible.

Retrieves a rectangle that bounds the tab area of the current tab control.

virtual void GetTabsRect(CRect& rect) const;

 

Parameters

[out] rect
When this method returns, the rect parameter contains a rectangle that bounds the tab area.

Retrieves the boundary of the client area of the current tab control.

void GetWndArea(CRect& rect) const;

 

Parameters

[in, out] rect
When this method returns, this parameter contains a rectangle that bounds the current tab control.

Remarks

Hides the horizontal scroll bar, if any, in the active window.

void HideActiveWindowHorzScrollBar();

Remarks

Use this method to prevent the tab control from blinking when the user switches between tab control pages.

Specifies whether the framework displays inactive tab control windows.

void HideInactiveWindow(BOOL bHide = TRUE);

Parameters

[in] bHide
TRUE not to display an inactive window; FALSE to display an inactive window. The default value is TRUE.

Remarks

Enables or disables drawing of the tab area if there are no visible tabs.

void HideNoTabs(BOOL bHide=TRUE);

Parameters

[in] bHide
TRUE to enable drawing the tab area; FALSE to disable drawing. The default value is TRUE.

Remarks

Enables or disables tab drawing if there is a single tabbed window.

virtual void HideSingleTab(BOOL bHide=TRUE);

Parameters

[in] bHide
TRUE to not draw a tab for a single tabbed window; FALSE to draw a single tab. The default value is TRUE.

Remarks

Indicates whether the current tab of a tab control is the active tab in a multiple document interface tab group.

BOOL IsActiveInMDITabGroup() const;

 

Return Value

TRUE if the current tab of a tab control is the active tab in an MDI tab group; otherwise, FALSE.

Remarks

You can organize multiple document windows into either vertical or horizontal tab groups and easily shuffle documents from one tab group to another.

Indicates whether the text of the active tab is displayed using a bold font.

BOOL IsActiveTabBoldFont() const;

 

Return Value

TRUE if the active tab is displayed using the bold font; otherwise, FALSE.

Remarks

Use the CMFCTabCtrl::SetActiveTabBoldFont method to change the active tab font.

Indicates whether the Close button ( X) is displayed on an active tab or on the upper-right corner of the tab area.

virtual BOOL IsActiveTabCloseButton() const;

 

Return Value

TRUE if the Close button is displayed on the active tab; FALSE if the Close button is displayed on the upper-right corner of the tab area.

Remarks

Indicates whether the tabbed window draws a frame rectangle around embedded panes.

BOOL IsDrawFrame() const;

 

Return Value

TRUE if a frame rectangle is drawn; otherwise, FALSE.

Remarks

Use the CMFCTabCtrl::SetDrawFrame method to enable or disable drawing a frame rectangle.

Indicates whether the frame around the tab area is flat or 3D.

BOOL IsFlatFrame() const;

 

Return Value

TRUE if the frame around the tab area is flat; FALSE if the frame is three-dimensional.

Remarks

Use the CMFCTabCtrl::SetFlatFrame method to change how the frame is drawn.

Indicates whether the appearance of the tabs in the current tab control is flat or not.

virtual BOOL IsFlatTab() const;

 

Return Value

TRUE if the appearance of the tabs in the current tab control is flat; otherwise, FALSE.

Indicates whether the appearance of the left and right side of a tab in the current tab control is rounded.

virtual BOOL IsLeftRightRounded() const;

 

Return Value

TRUE if the sides of each tab is rounded; otherwise, FALSE.

Indicates whether the current tab control is contained in the client area of a multiple-document interface window.

virtual BOOL IsMDITabGroup() const;

 

Return Value

TRUE if the current tab control is in an MDI client area window; otherwise, FALSE.

Indicates whether the current tab control is displayed in the style of Microsoft OneNote.

virtual BOOL IsOneNoteStyle() const;

 

Return Value

TRUE if the tab control is displayed in the style of Microsoft OneNote; otherwise, FALSE.

Indicates whether the current tab control has a scroll bar that can scroll its tabs as a group.

BOOL IsSharedScroll() const;

 

Return Value

TRUE if the tab control has a shared scroll bar; otherwise, FALSE.

Remarks

This method returns TRUE if the style parameter of the CMFCTabCtrl::Create method is STYLE_FLAT_SHARED_HORZ_SCROLL.

Indicates whether the tab control displays scroll buttons or a button that displays a menu of tabbed windows.

BOOL IsTabDocumentsMenu() const;

 

Return Value

TRUE if tabbed windows are scrolled using a popup menu of tabbed window labels; FALSE if tabbed windows are scrolled using forward and backward scroll buttons.

Remarks

Use the CMFCTabCtrl::EnableTabDocumentsMenu method to specify the method of scrolling tabbed windows.

Indicates whether tabs are drawn using the style of Visual Studio 2005.

virtual BOOL IsVS2005Style() const;

 

Return Value

TRUE if tabs are drawn using the style of Visual Studio 2005; otherwise, FALSE.

Remarks

Use the style parameter of the CMFCTabCtrl::Create method to specify how tabs are drawn.

Prevents the active view from losing focus when a new tab is inserted and enabled.

static BOOL m_bEnableActivate;  

Remarks

The focus is usually taken by a new tabbed window when the tab is inserted and made active. Set the CMFCTabCtrl::m_bEnableActivate member variable to FALSE to retain the original focus. The default value is TRUE.

Specifies the appearance of tabs in the current tab control.

BOOL ModifyTabStyle(Style style);

Parameters

[in] style
One of the enumeration values that specifies the appearance of the tab control. For more information, see the table in Remarks.

Return Value

Always TRUE.

Remarks

The value of the style parameter can be one of the following CMFCTabCtrl::Style enumerations.

NameDescription
STYLE_3DDisplays three-dimensional, rectangular tabs that have round corners.
STYLE_3D_ONENOTEDisplays three-dimensional tabs that have one vertical side and one slanted side and that have rounded corners.
STYLE_3D_ROUNDEDDisplays three-dimensional tabs that have slanted sides and rounded corners.
STYLE_3D_ROUNDED_SCROLLDisplays three-dimensional tabs that have slanted sides and rounded corners. If there are more tabs than can be displayed at the same time, the framework displays a drop-down arrow and a menu of tabs to make active.
STYLE_3D_SCROLLEDDisplays three-dimensional, rectangular tabs. If there are more tabs than can be displayed at the same time, the framework displays a drop-down arrow and a menu of tabs to make active.
STYLE_3D_VS2005Displays three-dimensional, rounded tabs that have one slanted side and one vertical side.
STYLE_FLATDisplays two-dimensional tabs that have slanted left and right sides.
STYLE_FLAT_SHARED_HORZ_SCROLLDisplays two-dimensional tabs. If there are more tabs than can be displayed at the same time, the framework displays scroll arrows at the ends of the tab area.

Called by the framework during a drag-and-drop operation when the cursor first enters the window of the current tab control.

virtual DROPEFFECT OnDragEnter(
    COleDataObject* pDataObject,  
    DWORD dwKeyState,  
    CPoint point);

Parameters

[in] pDataObject
Points to a data object that contains data that the user drags.

[in] dwKeyState
Contains the state of the modifier keys. This parameter is a bitwise combination (OR) of the following values: MK_CONTROL, MK_SHIFT, MK_ALT, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON. For more information, see the Message Parameters section of About Mouse Input.

[in] point
Contains the current location of the cursor in client coordinates.

Return Value

Always DROPEFFECT_NONE, which means that the drop target cannot accept the data.

Remarks

Use this method to support a drag-and-drop operation. Override this method to implement your own custom behavior.

By default, this method only calls CMFCTabCtrl::OnDragOver, which always returns DROPEFFECT_NONE.

Called by the framework during a drag operation when the mouse is moved over the drop target window.

virtual DROPEFFECT OnDragOver(
    COleDataObject* pDataObject,  
    DWORD dwKeyState,  
    CPoint point);

Parameters

[in] pDataObject
Pointer to a COleDataObject object that is being dragged over the drop target.

[in] dwKeyState
The state of the modifier keys, which is a bitwise combination (OR) of MK_CONTROL, MK_SHIFT, MK_ALT, MK_LBUTTON, MK_MBUTTON, and MK_RBUTTON. For more information, see "Message Parameters" in About Mouse Input.

[in] point
The current mouse position.

Return Value

Always DROPEFFECT_NONE.

Remarks

Override this method with your custom implementation. For more information, see the CView::OnDragOver method.

Displays a pop-up menu of tabbed windows, waits until the user selects a tab, and makes the selected tab the active tab.

virtual void OnShowTabDocumentsMenu(CPoint point);

Parameters

[in] point
The coordinates of where to display the pop-up menu.

Remarks

Sets the current tab of a tab control as the active tab in a multiple document interface tab group.

void SetActiveInMDITabGroup(BOOL bActive);

Parameters

[in] bActive
TRUE to make the current tab the active tab; FALSE to make the current tab inactive.

Remarks

You can organize multiple document windows into either vertical or horizontal tab groups and easily shuffle documents from one tab group to another.

Activates a tab.

virtual BOOL SetActiveTab(int iTab);

Parameters

[in] iTab
Specifies the zero-based index of the tab to activate.

Return Value

TRUE if the specified tab was made active; FALSE if the specified iTab parameter value is invalid.

Remarks

This method does not send the AFX_WM_CHANGE_ACTIVE_TAB notification to the parent window of the tab control.

The SetActiveTab method automatically calls the CMFCTabCtrl::HideActiveWindowHorzScrollBar method to prevent the screen from blinking.

Enables or disables use of a bold font on active tabs.

void SetActiveTabBoldFont(BOOL bIsBold=TRUE);

Parameters

[in] bIsBold
TRUE to use a bold font to display the label of the active tab; FALSE to use the standard font to display the label. The default value is TRUE.

Remarks

Specifies whether a frame rectangle is drawn around an embedded bar.

void SetDrawFrame(BOOL bDraw=TRUE);

Parameters

[in] bDraw
TRUE to display a frame rectangle around an embedded bar; otherwise, FALSE. The default value is TRUE.

Remarks

Specifies whether to draw a flat or a 3D frame around the tab area.

void SetFlatFrame(
    BOOL bFlat=TRUE,  
    BOOL bRepaint=TRUE);

Parameters

[in] bFlat
TRUE to draw a flat (2D) frame around the tab area; FALSE to draw a three-dimensional (3D) frame. The default value is TRUE.

[in] bRepaint
TRUE to redraw the window immediately; otherwise, FALSE. The default value is TRUE.

Remarks

Specifies an image list.

virtual BOOL SetImageList(
    UINT uiID,  
    int cx=15,  
    COLORREF clrTransp=RGB(255,
    0,
    255));

 
virtual BOOL SetImageList(
    HIMAGELIST hImageList);

Parameters

[in] uiID
The ID of a bitmap resource that contains the image list.

[in] cx
The width of each image, in pixels. The default value is 15.

[in] clrTransp
The transparent image color. The parts of the image that are this color will be transparent. The default value is the color magenta, RGB(255,0,255).

[in] hImageList
A handle to a preloaded image list.

Return Value

TRUE if this method is successful. FALSE if the tab control is created by using a flat style or if the first method overload cannot load the bitmap that is specified by the uiID parameter.

Remarks

Use this method to set an image list for the tab control. The images from the image list are displayed next to the tab label. This method recalculates the tab height so that the tab is sized to contain both the image and the text.

Use the CMFCBaseTabCtrl::AddTab method that is inherited by the tab control to specify the index of the image to display.

Specifies how the current tab control can be resized and then redisplays the control.

void SetResizeMode(ResizeMode resizeMode);

Parameters

[in] resizeMode
One of the CMFCTabCtrl::ResizeMode enumeration values that specifies how the tab control can be resized. For a list of possible values, see the table in Remarks.

Remarks

The resizeMode parameter can be one of the following ResizeMode enumeration values.

NameDescription
RESIZE_NOThe tab control cannot be resized.
RESIZE_VERTThe tab control can be resized vertically but not horizontally.
RESIZE_HORIZThe tab control can be resized horizontally but not vertically.

Specifies the maximum tab width in a tabbed window.

void SetTabMaxWidth(int nTabMaxWidth);

Parameters

[in] nTabMaxWidth
The maximum tab width, in pixels.

Remarks

Use this method to limit the width of each tab in a tabbed window. This method is useful if tabs have very long labels. The CMFCTabCtrl class constructor initializes the maximum tab width to 0, which actually means that the width is not limited.

Terminates the current resize operation on the tab control.

void StopResize(BOOL bCancel);

Parameters

[in] bCancel
TRUE to abandon the current resize operation; FALSE to complete the current resize operation. In either case, the framework stops drawing the resize rectangle.

Draws a horizontal scroll bar on a tab control that displays flat tabs.

BOOL SynchronizeScrollBar(SCROLLINFO* pScrollInfo = NULL);

Parameters

[out] pScrollInfo
Pointer to a SCROLLINFO structure or NULL. When this method returns, and if this parameter is not NULL, the structure contains all the parameters of the scroll bar. The default value is NULL.

Return Value

TRUE if this method succeeds; otherwise, FALSE.

Remarks

This method affects only a tab control that displays flat tabs. The scroll bar influences all the tabs at the same time.

Hierarchy Chart
Classes
CDockablePane Class
CDockablePane Class
CMFCBaseTabCtrl Class

Show: