【原】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