CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

DIALOG中怎样加菜单、状态栏、工具栏?

楼主lanlijing()2002-07-05 14:59:37 在 VC/MFC / 基础类 提问

同上。最好详细一点,本人很菜。 问题点数:40、回复次数:10Top

1 楼Crob(Take Everything Easy!)回复于 2002-07-05 15:04:18 得分 5

应该CControlBar和CDialogBarTop

2 楼nevergrief(孤独骑士)回复于 2002-07-05 15:06:20 得分 5

建议还是用SDI,在最后一步,Base   Class从CView改成CFormView,你的问题搞定!Top

3 楼zhuwenzheng(卧薪尝胆)回复于 2002-07-05 15:06:58 得分 5

http://www.vckbase.com/bbs/prime/viewprime.asp?id=3  
  http://www.vckbase.com/bbs/prime/viewprime.asp?id=387Top

4 楼lanlijing()回复于 2002-07-05 15:14:45 得分 0

我现在已经用DIALOG了。怎么办?  
  Top

5 楼wistaria(听风听雨)回复于 2002-07-05 15:20:22 得分 10

http://www.copathway.com/vchelp/zsrc/dlgtoolbar.zip  
  在基于对话框的应用程序中加入工具栏  
  本例程中:  
  1.   在资源中加入IDC_TOOLBAR1工具栏资源  
  2.   在.h文件中加入CToolBar   m_wndToolBar;变量  
  3.   在.cpp文件中OnInitDialog中加入  
  if(!m_wndToolBar.Create(this)   ||   !m_wndToolBar.LoadToolBar(IDR_TOOLBAR1))  
  {  
      TRACE0("Failed   to   Create   Dialog   Toolbar\n");  
      EndDialog(IDCANCEL);  
  }  
  CRect   rcClientOld;   //   Old   Client   Rect  
  CRect   rcClientNew;   //   New   Client   Rect   with   Tollbar   Added  
  GetClientRect(rcClientOld);   //   Retrive   the   Old   Client   WindowSize  
  //   Called   to   reposition   and   resize   control   bars   in   the   client   area   of   a   window  
  //   The   reposQuery   FLAG   does   not   really   traw   the   Toolbar.    
  //   It   only   does   the   calculations.  
  //   And   puts   the   new   ClientRect   values   in   rcClientNew    
  //   so   we   can   do   the   rest   of   the   Math.  
  RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,0,  
      reposQuery,rcClientNew);  
   
  //   All   of   the   Child   Windows   (Controls)   now   need   to   be   moved    
  //   so   the   Tollbar   does   not   cover   them   up.  
  //   Offest   to   move   all   child   controls   after   adding   Tollbar  
  CPoint   ptOffset(rcClientNew.left-rcClientOld.left,  
      rcClientNew.top-rcClientOld.top);  
   
  CRect   rcChild;  
  CWnd*   pwndChild   =   GetWindow(GW_CHILD);     //Handle   to   the   Dialog   Controls  
  while(pwndChild)   //   Cycle   through   all   child   controls  
  {  
      pwndChild->GetWindowRect(rcChild);   //     Get   the   child   control   RECT  
      ScreenToClient(rcChild);    
      rcChild.OffsetRect(ptOffset);    
          //   Changes   the   Child   Rect   by   the   values   of   the   claculated   offset  
      pwndChild->MoveWindow(rcChild,FALSE);   //   Move   the   Child   Control  
      pwndChild   =   pwndChild->GetNextWindow();  
  }  
   
  CRect   rcWindow;  
  GetWindowRect(rcWindow);   //   Get   the   RECT   of   the   Dialog  
  rcWindow.right   +=   rcClientOld.Width()   -   rcClientNew.Width();    
      //   Increase   width   to   new   Client   Width  
  rcWindow.bottom   +=   rcClientOld.Height()   -   rcClientNew.Height();    
      //   Increase   height   to   new   Client   Height  
  MoveWindow(rcWindow,FALSE);   //   Redraw   Window  
   
  //   Now   we   REALLY   Redraw   the   Toolbar  
  RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,0);  
  以上就完成了对话框中加入工具栏  
  Top

6 楼wistaria(听风听雨)回复于 2002-07-05 15:23:54 得分 10

加菜单:  
  在对话框的property对话框中style中选中system   menu  
  再在property对话框中generic中加入菜单Top

7 楼wistaria(听风听雨)回复于 2002-07-05 15:25:13 得分 0

加菜单:  
  在对话框的property对话框中style中选中system   menu  
  再在property对话框中generic中加入菜单Top

8 楼YP2002CN(混世阿呆)回复于 2002-07-05 15:27:39 得分 5

http://ycjy.jsipt.edu.cn/jsjx/VC/NewUpdate/Dialog/columnist_paper.pl-aid=alexandrite&pid=toolbar_in_dlg.htmTop

9 楼lanlijing()回复于 2002-07-05 15:35:58 得分 0

那状态栏了?  
  Top

10 楼lanlijing()回复于 2002-07-05 15:38:22 得分 0

那状态栏了?Top

11 楼zlxcjy(~您的朋友~)回复于 2003-05-07 16:36:15 得分 0

关注Top

相关问题

  • 查看菜单中有工具栏/状态栏,如何在程序中实现关闭/打开工具栏?
  • 如何对菜单、工具栏以及状态栏的颜色进行更改?
  • 如何用ASP代码隐藏IE的状态栏、菜单栏、工具栏?
  • 怎样去掉用超链接打开的新窗口的菜单、工具栏和状态栏???
  • 怎样能使浏览器窗体不显示菜单栏、工具栏和状态栏
  • 请帮我改一下代码,(改为点击连接后,弹出窗口--无工具栏,无状态栏,无菜单,大小为400*300的页面)
  • 急急急,我在打开一个页面以后,这个页面没有菜单栏、工具栏、状态栏。请问这个怎么实现?
  • 如何让一个htm网页打开后没有地址栏和工具栏,而只有菜单栏和状态栏,急用!!!
  • POST方式并且target="_blank"提交的新页面,能否不显示菜单栏、工具栏、状态栏以及控制窗口大小。
  • 表单提交后出来一个新窗口,如何设置这个窗口的样式,比如没有状态栏,工具栏,菜单,等等

关键词

  • toolbar
  • client
  • 工具栏
  • rcclientnew
  • wndtoolbar
  • 加入
  • www

得分解答快速导航

  • 帖主:lanlijing
  • Crob
  • nevergrief
  • zhuwenzheng
  • wistaria
  • wistaria
  • YP2002CN

相关链接

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

广告也精彩

反馈

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