Freigeben über


CDialogBar::Create

BOOLCreate(CWnd*pParentWnd,LPCTSTRlpszTemplateName**,UINTnStyle,UINTnID);**

BOOLCreate(CWnd*pParentWnd,UINTnIDTemplate**,UINTnStyle,UINTnID);**

Return Value

Nonzero if successful; otherwise 0.

Parameters

pParentWnd

A pointer to the parent CWnd object.

lpszTemplateName

A pointer to the name of the CDialogBar object’s dialog-box resource template.

nStyle

The alignment style of the dialog bar. The following styles are supported:

  • CBRS_TOP   Control bar is at the top of the frame window.

  • CBRS_BOTTOM   Control bar is at the bottom of the frame window.

  • CBRS_NOALIGN   Control bar is not repositioned when the parent is resized.

  • CBRS_LEFT   Control bar is at the left of the frame window.

  • CBRS_RIGHT   Control bar is at the right of the frame window.

nID

The control ID of the dialog bar.

nIDTemplate

The resource ID of the CDialogBar object’s dialog-box template.

Remarks

Loads the dialog-box resource template specified by lpszTemplateName or nIDTemplate, creates the dialog-bar window, sets its style, and associates it with the CDialogBar object.

If you specify the CBRS_TOP or CBRS_BOTTOM alignment style, the dialog bar’s width is that of the frame window and its height is that of the resource specified by nIDTemplate. If you specify the CBRS_LEFT or CBRS_RIGHT alignment style, the dialog bar’s height is that of the frame window and its width is that of the resource specified by nIDTemplate.

Example

// Mainfrm.h.

class CMainFrame : public CFrameWnd
{
// Constructor.
public:
   CMainFrame();
   virtual ~CMainFrame();

protected:  // Control bar embedded members.
   CDialogBar  m_wndDlgBar;

   // Other data members and methods.

   DECLARE_MESSAGE_MAP()
};


// Mainfrm.cpp.

#include "MainFrm.h"

/////////////////////////////////////////////////////

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
   if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
      return -1;

   EnableDocking(CBRS_ALIGN_ANY);

   // IDD_VIEWSELECT - Resource ID of the dialog
   // template. This dialog template should be created
   // with  the  style  WS_CHILD and no other style.
   // The template must not have the style WS_VISIBLE.

   if (!m_wndDlgBar.Create(this, IDD_VIEWSELECT,
      CBRS_LEFT|CBRS_TOOLTIPS|CBRS_FLYBY, IDD_VIEWSELECT))
   {
      TRACE0("Failed to create DlgBar\n");
      return -1;      // Fail to create.
   }

   return 0;
}

CDialogBar OverviewClass MembersHierarchy Chart

See Also   CDialogBar::CDialogBar