Property Grid alignment issue with sub-group
-
I am creating a simple property grid (CMFCPropertyGridCtrl) containing sub groups (value list) There is a alignment issue for the sub groups where the labels are drawn with a left offset (see in particular the "Level2" label) Why is the "Level2" label not aligned the same was as the "Level1" label? I would imagine that it should be aligned at the same level as the "subLevel1" label. See screenshot : http://imgur.com/9JeC4iz Here is how I code the property grid:
CMFCPropertyGridProperty\* level1Group = new CMFCPropertyGridProperty(\_T("Level1"), 0, TRUE ); CMFCPropertyGridProperty\* subLevel1 = new CMFCPropertyGridProperty(\_T("subLevel1"), \_T("subLevel1"), \_T("subLevel1") ); level1Group->AddSubItem(subLevel1); CMFCPropertyGridProperty\* level2Group = new CMFCPropertyGridProperty(\_T("Level2"), 0, TRUE ); CMFCPropertyGridProperty\* subLevel21 = new CMFCPropertyGridProperty(\_T("SubLevel2.1"), \_T("SubLevel2.1"), \_T("SubLevel2.1") ); CMFCPropertyGridProperty\* subLevel22= new CMFCPropertyGridProperty(\_T("SubLevel2.2"), \_T("SubLevel2.2"), \_T("SubLevel2.2") ); CMFCPropertyGridProperty\* subLevel23 = new CMFCPropertyGridProperty(\_T("SubLevel2.3"), \_T("SubLevel2.3"), \_T("SubLevel2.3") ); level2Group->AddSubItem(subLevel21); level2Group->AddSubItem(subLevel22); level2Group->AddSubItem(subLevel23); level1Group->AddSubItem(level2Group); m\_PropertyGrid.AddProperty(level1Group);
I tried inheriting my own CMFCPropertyGridProperty class and overwrite the OnDrawName but because of many protected members in the base class. (see CMFCPropertyGridProperty::OnDrawName in afxpropertygridctrl.cpp ) Now, I did overwrite the OnDrawName method, but removed lot of code that was in the base method that did not compile (access to protected members); but it seems to be OK. Thanks. Max.
I'd rather be phishing!