共用方式為


CMFCOutlookBarTabCtrl::AddControl

Adds a Windows control as a new tab in the Outlook bar.

void AddControl(
   CWnd* pWndCtrl,
   LPCTSTR lpszName,
   int nImageID=-1,
   BOOL bDetachable=TRUE,
   DWORD dwControlBarStyle=AFX_CBRS_FLOAT | AFX_CBRS_CLOSE |
                           AFX_CBRS_RESIZE | CBRS_AFX_AUTOHIDE 
);

Parameters

  • [in] pWndCtrl
    A pointer to a control to add.

  • [in] lpszName
    Specifies the name of tab.

  • [in] bDetachable
    If TRUE, the page will be created as detachable.

  • [in] nImageID
    Image index in the internal image list for the image to be displayed in the new tab.

  • [in] dwControlBarStyle
    Specifies the AFX_CBRS_* style for wrapped docking panes.

Remarks

Use this function to add a control as a new page of an outlook bar.

This function internally calls on CMFCBaseTabCtrl::AddTab.

If you set bDetachable to TRUE, AddControl internally creates a CDockablePaneAdapter object and wraps the added control. It automatically sets the runtime class of the tabbed window to the runtime class of CMFCOutlookBar and the runtime class of the floating frame to CMultiPaneFrameWnd.

Example

The following example demonstrates how to use the AddControl method in the CMFCOutlookBarTabCtrl class. This code snippet is part of the Outlook Demo sample.

    // CMFCOutlookBarTabCtrl* pOutlookBar
    // DWORD dwStyle = AFX_CBRS_FLOAT | AFX_CBRS_AUTOHIDE | AFX_CBRS_RESIZE
    // CMFCOutlookBarPane pane1
    // The third parameter is the image index.
    pOutlookBar->AddControl(&pane1, _T("General"), 0, TRUE, dwStyle);

Requirements

Header: afxOutlookBarTabCtrl.h

See Also

Reference

CMFCOutlookBarTabCtrl Class

Hierarchy Chart

CMFCOutlookBar Class

CMultiPaneFrameWnd Class