隐藏工具栏

导读:
  6 m_bStatusBarWasVisible=(m_wndStatusBar.IsWindowVisible()!=0); 7 m_wndStatusBar.ShowWindow(SW_HIDE);//隐藏状态栏 8
  9 // first create the new toolbar10 // this will contain the full-screen off button
  11 m_pwndFullScreenBar=new CToolBar;12 m_pwndFullScreenBar->Create(this);13 m_pwndFullScreenBar->LoadToolBar(IDR_FULLSCREEN);//显示退出全屏工具栏
  14 m_pwndFullScreenBar->SetBarStyle(m_pwndFullScreenBar->GetBarStyle() |
  15 CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);16 // to look better:
  17 m_pwndFullScreenBar->ModifyStyle(0, TBSTYLE_FLAT);18 m_pwndFullScreenBar->EnableDocking(0);19
  20 // place the full-screen off button somewhere:
  21 CPoint pt(300,200);22 FloatControlBar(m_pwndFullScreenBar,pt);23 24 // now save the old positions of the main and child windows
  25 GetWindowRect(&m_mainRect);26
  27 // remove the caption of the mainWnd:
  28 LONG style=::GetWindowLong(m_hWnd,GWL_STYLE);29 style&=~WS_CAPTION;30 ::SetWindowLong(m_hWnd,GWL_STYLE,style);31 int screenx=GetSystemMetrics(SM_CXSCREEN);32 int screeny=GetSystemMetrics(SM_CYSCREEN);33
  34 // resize:
  35 SetWindowPos(NULL,0,0,screenx,screeny,SWP_NOZORDER);36 //SetWindowPos(NULL,-5,-5,80,80,SWP_NOZORDER);
  37 style=::GetWindowLong(pChild->m_hWnd,GWL_STYLE);38 m_bChildMax=(style & WS_MAXIMIZE)?true:false
  39 // note here: m_bMainMax is not needed since m_hWnd only40 // changed its caption
  41 ///***************
  42
  43 //Save the Original Menu and set menu to NULL
  44 ASSERT(m_OrgMenu.GetSafeHmenu()==NULL);45 CMenu* pOldMenu=GetMenu();46 m_OrgMenu.Attach(pOldMenu->Detach());47 SetMenu((CMenu*)NULL);48
  49 //************50 // and maximize the child window51 // it will remove its caption, too.52 //pChild->
  53 this->ShowWindow (SW_SHOWMAXIMIZED);54 style=::GetWindowLong(pChild->m_hWnd,GWL_STYLE);//获得窗口风格
  55 style&=~WS_CAPTION;56 ::SetWindowLong(pChild->m_hWnd,GWL_STYLE,style); 57 pChild->ShowWindow(SW_SHOWMAXIMIZED);58
  59 //RecalcLayout();
  60 61
  62
  退出全屏
  1ASSERT(m_OrgMenu.GetSafeHmenu()!=NULL); 2 SetMenu(&m_OrgMenu); 3 m_OrgMenu.Detach(); 4 5 // You can use SaveBarState() in OnClose(), 6 // so remove the newly added toolbar entirely 7 // in order SaveBarState() not 8 // to save its state. That is why I used dynamic 9 // allocation
  10 delete m_pwndFullScreenBar;11 LONG style=::GetWindowLong(m_hWnd,GWL_STYLE);12 style|=WS_CAPTION;13 ::SetWindowLong(m_hWnd,GWL_STYLE,style);14 if(m_bToolBarWasVisible)15 m_wndToolBar.ShowWindow(SW_SHOW);16 if(m_bStatusBarWasVisible)17 m_wndStatusBar.ShowWindow(SW_SHOW);18 MoveWindow(&m_mainRect);19 RecalcLayout();20 CMDIChildWnd* pChild=MDIGetActive();2122 style=::GetWindowLong(pChild->m_hWnd,GWL_STYLE);23 style|=WS_CAPTION;24 ::SetWindowLong(pChild->m_hWnd,GWL_STYLE,style);25 //

本文转自
http://www.cppblog.com/colys/articles/24174.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值