vs2008sp1 急求CMFCPropertyGridCtrl的施用,进者有分
vs2008sp1 急求CMFCPropertyGridCtrl的使用,进者有分!
下面是问题:
CMFCPropertyGridCtrl 正常情况下都是两列(属性名---值)的形式,我现在想用它实现多列,像listctrl 控件一样自由设置列数及列头,应该如何处理?第一次使用cmfc类,,不怎么熟,,求指教啊!有示例或者实现方法最好啦!
先谢谢各位大侠啊!!!!!
------解决方案--------------------
这个没用过,不过给你找了个使用实例
http://serious.blog.51cto.com/242085/956984
------解决方案--------------------
VC 2010 sp1新特性之CMFCPropertyGridCtrl属性表控件功能扩展:设置列宽、禁用状态下的下拉框选中项
(1)设置列宽
下面是问题:
CMFCPropertyGridCtrl 正常情况下都是两列(属性名---值)的形式,我现在想用它实现多列,像listctrl 控件一样自由设置列数及列头,应该如何处理?第一次使用cmfc类,,不怎么熟,,求指教啊!有示例或者实现方法最好啦!
先谢谢各位大侠啊!!!!!
------解决方案--------------------
这个没用过,不过给你找了个使用实例
http://serious.blog.51cto.com/242085/956984
------解决方案--------------------
VC 2010 sp1新特性之CMFCPropertyGridCtrl属性表控件功能扩展:设置列宽、禁用状态下的下拉框选中项
(1)设置列宽
- C/C++ code
//头文件 #pragma once // CMyMFCPropertyGridCtrl class CMyMFCPropertyGridCtrl : public CMFCPropertyGridCtrl { DECLARE_DYNAMIC(CMyMFCPropertyGridCtrl) public: CMyMFCPropertyGridCtrl(); virtual ~CMyMFCPropertyGridCtrl(); protected: DECLARE_MESSAGE_MAP() public: void SetColumnWidth(INT value){m_nLeftColumnWidth=value;}; public: TCHAR GetListDelimeter(){return m_cListDelimeter;}; }; //.cpp文件 #include "stdafx.h" #include "MyMFCPropertyGridCtrl.h" // CMyMFCPropertyGridCtrl IMPLEMENT_DYNAMIC(CMyMFCPropertyGridCtrl, CMFCPropertyGridCtrl) CMyMFCPropertyGridCtrl::CMyMFCPropertyGridCtrl() { } CMyMFCPropertyGridCtrl::~CMyMFCPropertyGridCtrl() { } BEGIN_MESSAGE_MAP(CMyMFCPropertyGridCtrl, CMFCPropertyGridCtrl) END_MESSAGE_MAP()
------解决方案--------------------
http://technet.microsoft.com/zh-cn/magazine/bb983759.aspx
楼主可以看下这个 上面那个貌似发错了
------解决方案--------------------
楼主,VS不是自带列子的嘛,CMFCPropertyGridCtrl 不支持多列的。
- C/C++ code
void CPropertiesWnd::InitPropList() { m_wndPropList.EnableHeaderCtrl(FALSE); m_wndPropList.EnableDescriptionArea(); m_wndPropList.SetVSDotNetLook(); m_wndPropList.MarkModifiedProperties(); CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("Appearance")); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("3D Look"), (_variant_t) false, _T("Specifies the window's font will be non-bold and controls will have a 3D border"))); CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("Border"), _T("Dialog Frame"), _T("One of: None, Thin, Resizable, or Dialog Frame")); pProp->AddOption(_T("None")); pProp->AddOption(_T("Thin")); pProp->AddOption(_T("Resizable")); pProp->AddOption(_T("Dialog Frame")); pProp->AllowEdit(FALSE); pGroup1->AddSubItem(pProp); pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("Caption"), (_variant_t) _T("About"), _T("Specifies the text that will be displayed in the window's title bar"))); m_wndPropList.AddProperty(pGroup1); CMFCPropertyGridProperty* pSize = new CMFCPropertyGridProperty(_T("Window Size"), 0, TRUE); pProp = new CMFCPropertyGridProperty(_T("Height"), (_variant_t) 250l, _T("Specifies the window's height")); pProp->EnableSpinControl(TRUE, 50, 300); pSize->AddSubItem(pProp); pProp = new CMFCPropertyGridProperty( _T("Width"), (_variant_t) 150l, _T("Specifies the window's width")); pProp->EnableSpinControl(TRUE, 50, 200); pSize->AddSubItem(pProp); m_wndPropList.AddProperty(pSize); CMFCPropertyGridProperty* pGroup2 = new CMFCPropertyGridProperty(_T("Font")); LOGFONT lf; CFont* font = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT)); font->GetLogFont(&lf); lstrcpy(lf.lfFaceName, _T("Arial")); pGroup2->AddSubItem(new CMFCPropertyGridFontProperty(_T("Font"), lf, CF_EFFECTS | CF_SCREENFONTS, _T("Specifies the default font for the window"))); pGroup2->AddSubItem(new CMFCPropertyGridProperty(_T("Use System Font"), (_variant_t) true, _T("Specifies that the window uses MS Shell Dlg font"))); m_wndPropList.AddProperty(pGroup2); CMFCPropertyGridProperty* pGroup3 = new CMFCPropertyGridProperty(_T("Misc")); pProp = new CMFCPropertyGridProperty(_T("(Name)"), _T("Application")); pProp->Enable(FALSE); pGroup3->AddSubItem(pProp); CMFCPropertyGridColorProperty* pColorProp = new CMFCPropertyGridColorProperty(_T("Window Color"), RGB(210, 192, 254), NULL, _T("Specifies the default window color")); pColorProp->EnableOtherButton(_T("Other...")); pColorProp->EnableAutomaticButton(_T("Default"), ::GetSysColor(COLOR_3DFACE)); pGroup3->AddSubItem(pColorProp); static const TCHAR szFilter[] = _T("Icon Files(*.ico)|*.ico|All Files(*.*)|*.*||"); pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("Icon"), TRUE, _T(""), _T("ico"), 0, szFilter, _T("Specifies the window icon"))); pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("Folder"), _T("c:\\"))); m_wndPropList.AddProperty(pGroup3); CMFCPropertyGridProperty* pGroup4 = new CMFCPropertyGridProperty(_T("Hierarchy")); CMFCPropertyGridProperty* pGroup41 = new CMFCPropertyGridProperty(_T("First sub-level")); pGroup4->AddSubItem(pGroup41); CMFCPropertyGridProperty* pGroup411 = new CMFCPropertyGridProperty(_T("Second sub-level")); pGroup41->AddSubItem(pGroup411); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 1"), (_variant_t) _T("Value 1"), _T("This is a description"))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 2"), (_variant_t) _T("Value 2"), _T("This is a description"))); pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 3"), (_variant_t) _T("Value 3"), _T("This is a description"))); pGroup4->Expand(FALSE); m_wndPropList.AddProperty(pGroup4); }