다음을 통해 공유


CMFCToolBar::CreateEx

Creates a CMFCToolBar object that uses additional style options, such as large icons.

virtual BOOL CreateEx(
   CWnd* pParentWnd,
   DWORD dwCtrlStyle=TBSTYLE_FLAT,
   DWORD dwStyle=AFX_DEFAULT_TOOLBAR_STYLE,
   CRect rcBorders=CRect(1, 1, 1, 1),
   UINT nID=AFX_IDW_TOOLBAR 
);

Parameters

  • [in] pParentWnd
    A pointer to the parent window of the toolbar.

  • [in] dwCtrlStyle
    Additional styles for creating the embedded control bar object.

  • [in] dwStyle
    The toolbar style. See Toolbar Control and Button Styles for a list of appropriate styles.

  • [in] rcBorders
    A CRect object that specifies the widths of the toolbar window borders.

  • [in] nID
    The ID of the child window of the toolbar.

Return Value

Nonzero if this method succeeds; otherwise 0.

Remarks

This method creates a control bar and attaches it to the toolbar.

Call this method instead of CMFCToolBar::Create when you want to provide specific styles. For example, set dwCtrlStyle to TBSTYLE_FLAT | TBSTYLE_TRANSPARENT to create a toolbar that resembles the toolbars that are used by Internet Explorer 4.

Example

The following example demonstrates how to use the CreateEx method of the CMFCToolBar class. This code snippet is part of the IE Demo sample.

    CMFCToolBar     m_wndToolBar;


...


    // The this pointer points to CMainFrame class which extends the CFrameWnd class.
    if (!m_wndToolBar.CreateEx (this, TBSTYLE_TRANSPARENT) ||
        !m_wndToolBar.LoadToolBar (IDR_MAINFRAME, uiToolbarColdID, uiMenuID, 
            FALSE /* Not locked */, 0, 0, uiToolbarHotID))
    {
        TRACE0("Failed to create toolbar\n");
        return -1;      // fail to create
    }

Requirements

Header: afxtoolbar.h

See Also

Reference

CMFCToolBar Class

Hierarchy Chart

CMFCToolBar::Create