1. 可选Inplace Buttons一直显示,还是当其被选中问当前项时显示。
CXTPPropertyGrid::SetShowInplaceButtonsAlways();
2. 把CXTPPropertyGridItemSize 传入一个CSize 参数
3. Color item
CXTPPropertyGridItemColor
4. Data item
CXTPPropertyGridItemDate 传入一个 COleDateTime参数。
5. Font item
CXTPPropertyGridItemFont 传入LOGFONT参数。
LOGFONT lf;
GetFont()->GetLogFont( &lf );
6. Check box
这是自定义的 CCustomItemCheckBox,不是xtp库中自带的。如果使用可以参考。
7. Slider
自定义的 CCustomItemSlider
8. Spin Button
自定义的 CCustomItemSpin
9. Spin and slider
CXTPPropertyGridItem* pItem; pItem = pButtons->AddChildItem(new CXTPPropertyGridItemNumber(_T("Spin And Slider"), 60)); pItem->AddSliderControl(); pItem->AddSpinButton();
10. Popup menu
自定义 CCustomItemMenu
重载 virtual void OnInplaceButtonDown(CXTPPropertyGridInplaceButton* pButton);创建一个CMenu
11. 下拉选项中弹出对话框
点击<Edit…>,弹出对话框。
自定义 CCustomItemEdit
在virtual void OnValueChanged(CString strValue)中,判断选定的是哪个,然后弹出所需对话框。
12. Password
CXTPPropertyGridItem* pItemPassword = pCustom->AddChildItem(new CXTPPropertyGridItem(_T("Password"), _T("Text"))); pItemPassword->SetPasswordMask();
13. 带图标的下拉框
pItem = pMetrics->AddChildItem(new CXTPPropertyGridItemEnum(_T("Images"), 2)); pItem->GetConstraints()->AddConstraint(_T("Green"), 0, 0); pItem->GetConstraints()->AddConstraint(_T("Red"), 1, 1); pItem->GetConstraints()->AddConstraint(_T("Yellow"), 2, 2); pItem->GetConstraints()->AddConstraint(_T("Blue"), 3, 3); pItem->GetValueMetrics()->m_nImage = 2; pItem->GetCaptionMetrics()->m_nImage = 4; m_wndPropertyGrid.GetImageManager()->SetMaskColor(0xC0C0C0); m_wndPropertyGrid.GetImageManager()->SetIcons(IDB_BITMAP_CONSTRAINTS, 0, 5, CSize(20, 14));
14. 自定义的颜色下拉框
自定义的 CCustomItemColor 派生自CXTPPropertyGridItemColor
15. 多行文本
CXTPPropertyGridItemMultilineString
16. Ip address
自定义 CCustomItemIPAddress
17. 高亮被修改的items
所有的被修改的items都会高亮
CXTPPropertyGrid::HighlightChangedItems
18. Hyperlink button
pItem = pButtons->AddChildItem(new CXTPPropertyGridItem(_T("Hyperlink Button"))); pItem->SetFlags(0); pButton = pItem->GetInplaceButtons()->AddButton(new CXTPPropertyGridInplaceButton(1)); pButton->SetHyperlink(); pButton->SetShowAlways(TRUE); pButton->SetAlignment(DT_LEFT); pButton->SetCaption(_T("Click Me"));
19. Image button
pItem = pButtons->AddChildItem(new CXTPPropertyGridItem(_T("Image Button"))); pButton = pItem->GetInplaceButtons()->AddButton(new CXTPPropertyGridInplaceButton(1)); pButton->SetIconIndex(100); UINT btnFilter[] = {100}; m_wndPropertyGrid.GetImageManager()->SetIcons(IDB_BITMAP_FILTER, btnFilter, 1, 0); pButton->SetTooltip(_T("Set Filter for item"));
20. Text button
pItem = pButtons->AddChildItem(new CXTPPropertyGridItem(_T("Text Button"))); CXTPPropertyGridInplaceButton* pButton = pItem->GetInplaceButtons()->AddButton(new CXTPPropertyGridInplaceButton(1)); pButton->SetCaption(_T("Find"));
21. Option item
CXTPPropertyGridItemOption* pItemOption; pItemOption= (CXTPPropertyGridItemOption*)pStandard->AddChildItem(new CXTPPropertyGridItemOption(_T("Option item"), 1 + 2)); pItemOption->GetConstraints()->AddConstraint(_T("Windows XP"), 1); pItemOption->GetConstraints()->AddConstraint(_T("Windows 2000"), 2); pItemOption->SetCheckBoxStyle(); pItemOption = (CXTPPropertyGridItemOption*)pStandard->AddChildItem(new CXTPPropertyGridItemOption(_T("Option item"), 1)); pItemOption->GetConstraints()->AddConstraint(_T("Windows XP"), 1); pItemOption->GetConstraints()->AddConstraint(_T("Windows 2000"), 2);
22. 控件边框样式
xtpGridBorderNone
xtpGridBorderFlat
xtpGridBorderClientEdge
m_wndPropertyGrid.SetBorderStyle
23. 控件主题
xtpGridThemeOffice2007
m_wndPropertyGrid.SetTheme
24. 在属性表中使用PropertyGrid
为每个属性页中添加PropertyGrid控件,两种方式:
在.rc文件中
CONTROL "PropertyGrid",IDC_PROPERTY_GRID,"XTPPropertyGrid", WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_GROUP | WS_TABSTOP,7,7,159,144
在属性页的OnInitDialog函数中动态创建。
1. 可选Inplace Buttons一直显示,还是当其被选中问当前项时显示。
CXTPPropertyGrid::SetShowInplaceButtonsAlways();
2. 把CXTPPropertyGridItemSize 传入一个CSize 参数
3. Color item
CXTPPropertyGridItemColor
4. Data item
CXTPPropertyGridItemDate 传入一个 COleDateTime参数。
5. Font item
CXTPPropertyGridItemFont 传入LOGFONT参数。
LOGFONT lf;
GetFont()->GetLogFont( &lf );
6. Check box
这是自定义的 CCustomItemCheckBox,不是xtp库中自带的。如果使用可以参考。
7. Slider
自定义的 CCustomItemSlider
8. Spin Button
自定义的 CCustomItemSpin
9. Spin and slider
CXTPPropertyGridItem* pItem;
pItem = pButtons->AddChildItem(new CXTPPropertyGridItemNumber(_T("Spin And Slider"), 60));
pItem->AddSliderControl();
pItem->AddSpinButton();
10. Popup menu
自定义 CCustomItemMenu
重载 virtual void OnInplaceButtonDown(CXTPPropertyGridInplaceButton* pButton);创建一个CMenu
11. 下拉选项中弹出对话框
点击<Edit…>,弹出对话框。
自定义 CCustomItemEdit
在virtual void OnValueChanged(CString strValue)中,判断选定的是哪个,然后弹出所需对话框。
12. Password
CXTPPropertyGridItem* pItemPassword = pCustom->AddChildItem(new CXTPPropertyGridItem(_T("Password"), _T("Text")));
pItemPassword->SetPasswordMask();
13. 带图标的下拉框
pItem = pMetrics->AddChildItem(new CXTPPropertyGridItemEnum(_T("Images"), 2));
pItem->GetConstraints()->AddConstraint(_T("Green"), 0, 0);
pItem->GetConstraints()->AddConstraint(_T("Red"), 1, 1);
pItem->GetConstraints()->AddConstraint(_T("Yellow"), 2, 2);
pItem->GetConstraints()->AddConstraint(_T("Blue"), 3, 3);
pItem->GetValueMetrics()->m_nImage = 2;
pItem->GetCaptionMetrics()->m_nImage = 4;
m_wndPropertyGrid.GetImageManager()->SetMaskColor(0xC0C0C0);
m_wndPropertyGrid.GetImageManager()->SetIcons(IDB_BITMAP_CONSTRAINTS, 0, 5, CSize(20, 14));
14. 自定义的颜色下拉框
自定义的 CCustomItemColor 派生自CXTPPropertyGridItemColor
15. 多行文本
CXTPPropertyGridItemMultilineString
16. Ip address
自定义 CCustomItemIPAddress
17. 高亮被修改的items
所有的被修改的items都会高亮
CXTPPropertyGrid::HighlightChangedItems
18. Hyperlink button
pItem = pButtons->AddChildItem(new CXTPPropertyGridItem(_T("Hyperlink Button")));
pItem->SetFlags(0);
pButton = pItem->GetInplaceButtons()->AddButton(new CXTPPropertyGridInplaceButton(1));
pButton->SetHyperlink();
pButton->SetShowAlways(TRUE);
pButton->SetAlignment(DT_LEFT);
pButton->SetCaption(_T("Click Me"));
19. Image button
pItem = pButtons->AddChildItem(new CXTPPropertyGridItem(_T("Image Button")));
pButton = pItem->GetInplaceButtons()->AddButton(new CXTPPropertyGridInplaceButton(1));
pButton->SetIconIndex(100);
UINT btnFilter[] = {100};
m_wndPropertyGrid.GetImageManager()->SetIcons(IDB_BITMAP_FILTER, btnFilter, 1, 0);
pButton->SetTooltip(_T("Set Filter for item"));
20. Text button
pItem = pButtons->AddChildItem(new CXTPPropertyGridItem(_T("Text Button")));
CXTPPropertyGridInplaceButton* pButton = pItem->GetInplaceButtons()->AddButton(new CXTPPropertyGridInplaceButton(1));
pButton->SetCaption(_T("Find"));
21. Option item
CXTPPropertyGridItemOption* pItemOption;
pItemOption= (CXTPPropertyGridItemOption*)pStandard->AddChildItem(new CXTPPropertyGridItemOption(_T("Option item"), 1 + 2));
pItemOption->GetConstraints()->AddConstraint(_T("Windows XP"), 1);
pItemOption->GetConstraints()->AddConstraint(_T("Windows 2000"), 2);
pItemOption->SetCheckBoxStyle();
pItemOption = (CXTPPropertyGridItemOption*)pStandard->AddChildItem(new CXTPPropertyGridItemOption(_T("Option item"), 1));
pItemOption->GetConstraints()->AddConstraint(_T("Windows XP"), 1);
pItemOption->GetConstraints()->AddConstraint(_T("Windows 2000"), 2);
22. 控件边框样式
xtpGridBorderNone
xtpGridBorderFlat
xtpGridBorderClientEdge
m_wndPropertyGrid.SetBorderStyle
23. 控件主题
xtpGridThemeOffice2007
m_wndPropertyGrid.SetTheme
24. 在属性表中使用PropertyGrid
为每个属性页中添加PropertyGrid控件,两种方式:
在.rc文件中
CONTROL "PropertyGrid",IDC_PROPERTY_GRID,"XTPPropertyGrid",
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_GROUP |
WS_TABSTOP,7,7,159,144
在属性页的OnInitDialog函数中动态创建。