现在的位置: 首页 > 综合 > 正文

vs2008 MFC 开发问题汇总

2013年12月08日 ⁄ 综合 ⁄ 共 684字 ⁄ 字号 评论关闭

        1、在自定义工具栏时,发现菜单的标题有问题,于是修改工具栏的标题,发现在工具栏创建后调用SetWindowText()根本不起效果。就好象有自动记忆功能一样。解决:
        Handle WM_NCPAINT message,重绘非客户区,在其中修改标题就可以了。

       2、网上“用VS2008 Feature Pack 修改您现有的Visual C++的程序界面”有很多,在用以下在CMainFrame::OnCreate()函数的最后部分,添加代码设定当前界面的风格:
      CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007));
      CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007Luna_Blue);
系统将会出现“Cannot load Style”错误!
      调试了很长时间,才找出原因:

4 #if !defined _AFXDLL
5 TRACE(_T("/r/nImportant: to enable the Office 2007 look in static
link,/r/n"));
6 TRACE(_T("include afxribbon.rc from the RC file in your
project./r/n/r/n"));
7 ASSERT(FALSE);
8 #endif

    需要在方案的RC文件中include afxribbon.rc资源。

抱歉!评论已关闭.