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

来源:互联网 发布:oracle sql优化案例 编辑:程序博客网 时间:2024/05/01 14:28

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);

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

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/xumingxsh/archive/2008/01/23/2061389.aspx

原创粉丝点击