如何使CMDIChildWnd在MFC中可停靠
How to Make CMDIChildWnd as Dockable in MFC?
我想让CMDIChildWnd成为可停靠的....我的代码创建窗口框架时单击功能区按钮,我想以选项卡式格式停靠所有窗口,当我放置拖动我的框架时显示停靠管理器格式[DT_SMART]...
此代码是按钮单击事件创建多个帧...。
pDocTemplate_New1 = new CMultiDocTemplate ( IDR_RiboonCFormViewTYPE,
RUNTIME_CLASS(CRiboonCFormViewTestDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CDepartement));
AfxGetApp () -> AddDocTemplate (pDocTemplate_New1);
// Create a new child window
CMDIChildWnd * pMDIActive = MDIGetActive (); // get the pointer of the currently active child window
//CDocument * pDoc = (CDocument *) pMDIActive-> GetActiveDocument (); // get the document pointer
CMDIChildWnd * pNewFrame = (CMDIChildWnd *) (pDocTemplate_New1 -> CreateNewFrame (NULL, NULL));
pNewFrame->EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
// Create a new frame window
if (pNewFrame == NULL)
{
AfxMessageBox("new window can not be established ", MB_OK, 0);
}
pDocTemplate_New1 -> InitialUpdateFrame (pNewFrame, NULL); // display window
MDITile (MDITILE_HORIZONTAL); // tile multiple windows
- 首先创建可停靠窗格,
- 要创建可停靠窗格,必须先从
CMDIFrameWndEx
派生。 - 在
CMainFrame
中添加该窗格成员 - 重要的样式
CBRS_FLOAT_MULTI
使可停靠窗格在附加到选项卡时作为一个单元浮动。像CBRS_LEFT
这样的对齐样式为窗格提供初始对齐方式。
选项卡式窗格是将窗格 - 相互停靠以形成内部具有单个窗格的常规选项卡控件的概念。使用
AttachToTabWnd
() 添加窗格
相关文章:
- C++ MFC Libraries in Travis CI
- 从 bmp 文件数据创建 MFC CBitmap
- 如何在 MFC 中显示文件的所有行
- 目录删除 MFC 的问题
- MFC:如何设置CEdit框的焦点?
- MFC 中的抗锯齿
- 双击更改 mfc 中列表控件中的行的颜色
- C++MFC编辑框处理双击
- C++ MFC CObject 派生类摘要?
- 如何在 MFC 对话框中使用 OnDraw
- 在 1 个服务器 n 客户端套接字 C++ MFC 应用程序中更新数据的客户端
- MFC:你能在CDateTimeCtrl中改变自旋的加速度吗?
- MFC:我们如何轻松地从CTreeCtrl切换到CTreeView?
- __int64 CString 返回错误的值 - C++ MFC
- 如何在MFC中的静态文本控件上插入图标?
- 使用 MFC 的表/网格
- MFC 中的窗口消息管理:添加基类调用是否是强制性的?
- MFC/C++ ComboBox:禁用下拉列表关闭和打开(UI 冻结)的绘制
- MFC停靠对话框在外部/不在CMainFrame中
- 如何使CMDIChildWnd在MFC中可停靠