Home > Software engineering >  Why use CDockablePane as docked window, can't display properly?
Why use CDockablePane as docked window, can't display properly?

Time:11-12

//project MDI type
//MyToolPanel. H file
The class CMyToolPanel: public CDockablePane
{
DECLARE_DYNAMIC (CMyToolPanel)

Public:
CMyToolPanel ();
Virtual ~ CMyToolPanel ();

Protected:
DECLARE_MESSAGE_MAP ()

Protected:
CmyOpDlg m_dlg;

Public:
Afx_msg int OnCreate (LPCREATESTRUCT LPCREATESTRUCT);
Afx_msg void OnDestroy ();
Cx, afx_msg void OnSize (UINT nType, int int cy);
};

//MyToolPanel. CPP file
Int CMyToolPanel: : OnCreate (LPCREATESTRUCT LPCREATESTRUCT)
{
If (CDockablePane: : OnCreate (lpCreateStruct)==1)
return -1;

M_dlg. Create (IDD_DIALOG1, this);
M_dlg. ShowWindow (SW_SHOW);

return 0;
}


Void CMyToolPanel... OnDestroy ()
{
CDockablePane... OnDestroy ();
M_dlg. DestroyWindow ();
}


Void CMyToolPanel: : OnSize (UINT nType, cx, int int cy)
{
CDockablePane: : OnSize (cx, nType, cy);

If (m_dlg GetSafeHwnd ())
{
CRect RCT.
GetClientRect (RCT);
M_dlg. MoveWindow (RCT);
}
}

//in CMainFrame: : add the following code to the OnCreate, including m_Panel in MainFrm. H definition CMyToolPanel m_Panel;
M_Panel. Create (_T (Dlg "Tool"),
This,
CRect (0, 0, 200, 200),
True,//true: can display the title bar, and can be parked. False to cancel the title bar and docking,
1301,
WS_CHILD
| WS_VISIBLE
| WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
| CBRS_RIGHT | CBRS_LEFT//
| CBRS_FLOAT_MULTI);
DockPane (& amp; M_Panel);
M_Panel. EnableDocking (CBRS_ALIGN_RIGHT | CBRS_ALIGN_LEFT);

//run time, the main window background can't refresh, child window can't operate, also can't see the docking window, if not in the view menu select Dlg Tool can display properly,
  • Related