隐藏标题栏
主框架OnCreate函数中
ModifyStyle(WS_CAPTION, 0, 0);
隐藏菜单
void CMDIFrameWndEx_THS::RecalcLayout(BOOL bNotify)
{
// TODO: 在此添加专用代码和/或调用基类
CDocManager *pDocManager = AfxGetApp()->m_pDocManager;
POSITION pos = pDocManager->GetFirstDocTemplatePosition();
while(pos)
{
CMultiDocTemplate *pDocTemplate =
(CMultiDocTemplate*)pDocManager->GetNextDocTemplate(pos);
pDocTemplate->m_hMenuShared = NULL;
}
SetMenu(NULL);
__super::RecalcLayout(bNotify);
}
创建CDockablePane
class CPaneExtend : public CDockablePane
{
DECLARE_DYNAMIC(CPaneExtend)
public:
CPaneExtend();
virtual ~CPaneExtend();
public:
virtual BOOL IsResizable() const { return FALSE; } // 不能改变大小
virtual int GetCaptionHeight() const { return 0;} // 标题栏高度
virtual BOOL CanFloat() const { return FALSE; } // 不能浮动
virtual BOOL CanBeClosed() const { return FALSE; } // 不能关闭
virtual BOOL OnShowControlBarMenu(CPoint point) {return TRUE;} // 不显示右键上下文菜单
};
// 主框架OnCreate函数中创建DockablePane
m_pExtendPane = new CPaneExtend;
if (!m_pExtendPane->Create(
TEXT("面板"),
this,
CRect(0, 0, 200, 100),
FALSE,
1001,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_TOP | CBRS_FLOAT_MULTI))
{
TRACE0( TEXT("Failed to create pane"));
return -1;
}
m_pExtendPane->EnableDocking(CBRS_ALIGN_TOP);
EnableDocking(CBRS_ALIGN_ANY);
AddPane(m_pExtendPane);