CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

How to Create a StatusBar in a Dialog.

楼主rabbit(Mail_Man)2000-02-21 18:09:00 在 VC/MFC / 基础类 提问

问题点数:50、回复次数:4Top

1 楼cloud(八大山人)回复于 2000-02-21 18:22:00 得分 0

试试照着CMainFrame::OnCreate中建StatusBar写,没试过。Top

2 楼Fancy()回复于 2000-02-21 18:25:00 得分 50

看看下面這段程序,   一定會有幫助  
  BOOL   CModelessMain::OnInitDialog()  
  {  
  CModelessDialog::OnInitDialog();  
   
  //   Create   status   bar   at   the   bottom   of   the   dialog   window  
  if   (m_statusBar.Create(this))  
  {  
  m_statusBar.SetIndicators(m_lpaIDStatusBar,   m_cIDStatusBar);  
  OnSetMessageString(AFX_IDS_IDLEMESSAGE);  
   
  //   Make   a   sunken   or   recessed   border   around   the   first   pane  
  m_statusBar.SetPaneInfo(0,   m_statusBar.GetItemID(0),  
  SBPS_STRETCH,   NULL   );  
  }  
   
  //   Create   toolbar   at   the   top   of   the   dialog   window  
  if   (m_toolBar.Create(this))  
  {  
  m_toolBar.LoadBitmap(m_nIDBitmap);  
  m_toolBar.SetButtons(m_lpaIDToolBar,   m_cIDToolBar);  
  }  
   
  m_toolBar.SetBarStyle(m_toolBar.GetBarStyle()     and    
  CBRS_TOOLTIPS     and     CBRS_FLYBY     and     CBRS_SIZE_DYNAMIC);  
   
  //   We   need   to   resize   the   dialog   to   make   room   for   control   bars.  
  //   First,   figure   out   how   big   the   control   bars   are.  
  CRect   rcClientStart;  
  CRect   rcClientNow;  
  GetClientRect(rcClientStart);  
  RepositionBars(AFX_IDW_CONTROLBAR_FIRST,   AFX_IDW_CONTROLBAR_LAST,  
        0,   reposQuery,   rcClientNow);  
   
  //   Now   move   all   the   controls   so   they   are   in   the   same   relative  
  //   position   within   the   remaining   client   area   as   they   would   be  
  //   with   no   control   bars.  
  CPoint   ptOffset(rcClientNow.left   -   rcClientStart.left,  
  rcClientNow.top   -   rcClientStart.top);  
   
  CRect     rcChild;  
  CWnd*   pwndChild   =   GetWindow(GW_CHILD);  
  while   (pwndChild)  
  {  
  pwndChild->GetWindowRect(rcChild);  
  ScreenToClient(rcChild);  
  rcChild.OffsetRect(ptOffset);  
  pwndChild->MoveWindow(rcChild,   FALSE);  
  pwndChild   =   pwndChild->GetNextWindow();  
  }  
   
  //   Adjust   the   dialog   window   dimensions  
  CRect   rcWindow;  
  GetWindowRect(rcWindow);  
  rcWindow.right   +=   rcClientStart.Width()   -   rcClientNow.Width();  
  rcWindow.bottom   +=   rcClientStart.Height()   -   rcClientNow.Height();  
  MoveWindow(rcWindow,   FALSE);  
   
  //   And   position   the   control   bars  
  RepositionBars(AFX_IDW_CONTROLBAR_FIRST,   AFX_IDW_CONTROLBAR_LAST,   0);  
   
  //   Set   the   icon   for   this   dialog.     The   framework   does   this   automatically  
  //     when   the   application's   main   window   is   not   a   dialog  
  SetIcon(m_hIcon,   TRUE);                   //   Set   big   icon  
  SetIcon(m_hIcon,   FALSE);                 //   Set   small   icon  
   
  //   Finally,   center   the   dialog   on   the   screen  
  CenterWindow();  
  return   TRUE;  
  }Top

3 楼xenogear()回复于 2000-02-21 18:27:00 得分 0

用CStatusBar类Top

4 楼skt642()回复于 2001-05-31 17:35:00 得分 0

18059关注!Top

相关问题

  • 如何在dialog程序中添加statusbar?
  • 为什么我在Dialog中加入一个StatusBar失败了呀!
  • Somebody help me!(Create a Dialog Without Dialog Resource)
  • dialog
  • how to remove sizebox in statusbar?
  • StatusBar急救
  • 关于statusbar
  • StatusBar的问题
  • statusbar的问题
  • StatusBar的问题

关键词

  • toolbar
  • statusbar
  • dialog
  • bars
  • create
  • and cbrs

得分解答快速导航

  • 帖主:rabbit
  • Fancy

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo