CPropertySheet 使用技巧

CPropertySheet 使用技巧

作者:lixiaosan
日期:04/13/2006

文章不断更新中。。。请点击
这里

前言:

其实,已经有前人做过关于CPropertySheet的使用介绍。
参考
http://www.codeguru.com/Cpp/controls/propertysheet/article.php/c3973/
在该文中,作者介绍了以下一些应用技巧:
1.隐藏和移动标准按钮(ok, cancel,apply,help)
2.改变 Tab Label 的文本内容
3.改变 Tab Label 的文本字体
4.在Tab Label上使用image
5.在Property Sheet上放一个Bitmap
6.在Property Sheet上添加控件
7.在Property Sheet上部添加一个header
8.响应标准按钮

还有 MFC 提供的例子,建议大家先下载下来自己研究
Visual C++ MFC Samples      
PROPDLG Sample: Demonstrates Property Sheet Support
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample/html/_sample_mfc_PROPDLG.asp

在本文中,作者就介绍以下其中没有提及的一些功能和使用问题。
(基本上来说网上都有现成的实现,就贴URL。。)



1. 创建非模态的CPropertySheet并实现标准按钮的响应(非模态的CPropertySheet默认是没有任何button的)


Q146916:
How To Create a Modeless CPropertySheet with Standard Buttons
http://support.microsoft.com/kb/146916/en-us




2. 隐藏Apply按钮(前言链接中的实现也包括在以下链接的介绍中)

Q141039:
HOWTO: How to Hide the Apply Button in CPropertySheet
http://support.microsoft.com/kb/141039/en-us




3. 一个非模态的CPropertySheet是一个对话框或者CPropertySheet的子控件,当进行焦点切换时,应用程序无响应的问题

   BOOL CMySheet::OnInitDialog()
   {
        ModifyStyleEx (0, WS_EX_CONTROLPARENT);//添加该句

        return CPropertySheet::OnInitDialog();
   }

详细解释请参阅:
Q149501:PRB: Child CPropertySheet Hangs If Focus Is Switched
http://support.microsoft.com/kb/149501/en-us




4. 在运行时改变 CPropertyPage 大小

Q143291: 
How to resize CPropertyPages at run time in Visual C++
http://support.microsoft.com/kb/143291/en-us




5. 调用 CPropertySheet 的 DoModal 或 Create 时显示 “0xC0000005: Access Violation”错误

Q158552: 
You receive a "0xC0000005: Access Violation" error message when you call the CPropertySheet::DoModal method or the Create method in Visual C++
http://support.microsoft.com/kb/158552/en-us




6. 设置 CPropertySheet 的 默认按钮

Q140587:HOWTO: How to Change Default Button on CPropertySheet
http://support.microsoft.com/kb/140587/en-us




7. Disable Tab

Q151662: 
HOWTO: How To Disable Tabs in CPropertySheet
http://support.microsoft.com/kb/151662/en-us

disable tab同时使tab变灰
http://www.codeguru.com/cpp/controls/propertysheet/article.php/c549/
http://www.microsoft.com/msj/0398/c0398.aspx




8. 改变 Tab Label 的文本内容(前言链接中的实现也包括在以下链接的介绍中)

Q141487:
HOWTO: How to Change the Text in the Tabs of a CPropertySheet
http://support.microsoft.com/kb/141487/en-us




9. 在 CPropertySheet 的 title bar 上加帮助按钮 Context Help Button

Q244232:
How To Add Context Help Button (? Button) to Title Bar of CPropertySheet
http://support.microsoft.com/kb/244232/en-us




10. tab 标签行使用scrollbar

CPropertySheet在DoModal或create前调用EnableStackedTabs(FALSE);




11. 改变 CPropertyPage 字体

Q142170:
Prpfont.exe sample demonstrates how to set the desired font for your CPropertyPages in Visual C++
http://support.microsoft.com/kb/142170/en-us




12. 改变选中的Tab 的 文本颜色

Q206626:
How to change the text color of the selected property sheet tab in Visual C++
http://support.microsoft.com/kb/206626/en-us




13. 可改变大小的CPropertySheet

Q300606:
How to implement a resizable property sheet class that contains a menu bar in Visual C++ 6.0
http://support.microsoft.com/kb/300606/en-us




14. 改变 CPropertyPage 上控件的默认focus

Q148388:
HOWTO: How to Change Default Control Focus on CPropertyPage
http://support.microsoft.com/kb/148388/en-us




15. wizard 风格的CPropertySheet同时显示Back/Next button 和 Finish button

默认情况下,Finish是在Next下的,并且是hidden的。所以如果要同时显示,需要show finish,并且移动Next。
Q143210:
HOWTO: How to Add the Finish Button to a Wizard Property Sheet
http://support.microsoft.com/kb/143210/en-us




16. 实现 help button 的消息响应

Q132715:
HOWTO: How to Enable the Help Button on a Modal Property Sheet
http://support.microsoft.com/kb/132715/en-us




17. CPropertySheet 添加快捷键

Q142384:
HOWTO: How to Create Accelerators for CPropertyPages
http://support.microsoft.com/kb/142384/en-us




18. Wizard97 风格的属性表的实现

http://www.codeproject.com/property/conquering_wizard97.asp
 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值