随笔 - 34, 文章 - 3, 评论 - 10, 引用 - 0
数据加载中……

在mfc中,设置一个隐藏菜单栏,工具栏,状态栏,最大化、最小化、关闭按钮的窗体

 

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

 
// 去掉标题栏
 /*
 if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
*/
 
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC))
 {
  TRACE0(
"Failed to create toolbar\n");
  
return -1;      // fail to create
 }

 
// 去掉状态栏
 /*
 if (!m_wndStatusBar.Create(this) ||
  !m_wndStatusBar.SetIndicators(indicators,
    sizeof(indicators)/sizeof(UINT)))
 {
  TRACE0("Failed to create status bar\n");
  return -1;      // fail to create
 }
*/

 
// TODO: Delete these three lines if you don't want the toolbar to
 
//  be dockable

 m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
 EnableDocking(CBRS_ALIGN_ANY);
 DockControlBar(
&m_wndToolBar);

 
// 设置标题--标题显示为:无标题-天志的导航
 
//this->SetTitle("天志的导航");


 
// 隐藏最大化,最小化,关闭按钮
 ModifyStyle(WS_SYSMENU, 0);


// 隐藏标题栏
 ModifyStyle(WS_CAPTION, 0);

 
// 去掉菜单栏
 SetMenu(NULL);

 
// 全屏显示
 RECT rc;
 ::GetWindowRect(::GetDesktopWindow(), 
&rc);  
 
this->MoveWindow(&rc);

 
return 0;
}


去掉标题栏:
在OnCreate函数中,添加如下代码:
ModifyStyle(WS_CAPTION, 0, SWP_FRAMECHANGED);

单文档,多文档中都是如此

posted on 2009-05-26 02:55 wsy6634 阅读(2926) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理