简体   繁体   English

MFC PropertyGrid不会在用户单击时扩展(禁用)

[英]MFC PropertyGrid will not expand on user click (disabled)

I'm actually working with the MFC Property grid and, I wish to allow the user to expand the Items. 我实际上正在使用MFC属性网格,并且希望允许用户扩展“项目”。

Basically I'm adding items to a MFC Property grid 基本上我是将项目添加到MFC属性网格

CMFCPropertyGridProperty* mParent = new CMFCPropertyGridProperty(_T("cycle"));
mGrid.AddProperty(mParent);
mParent->AddSubItem(new CMFCPropertyGridProperty(_T("Id"),        _T("test")));
mParent->AddSubItem(new CMFCPropertyGridProperty(_T("Name"),      _T("test")));
mParent->AddSubItem(new CMFCPropertyGridProperty(_T("DateStart"), _T("test")));
mParent->AddSubItem(new CMFCPropertyGridProperty(_T("DateStop"),  _T("test")));

Basically I want all Items to be nonExpanded when I add them but I want the user to be able to expand them However, it seems that the default behavior is to prevent the user from expanding Items... 基本上,我希望所有项目在添加时都不会展开,但我希望用户能够展开它们。但是,似乎默认行为是阻止用户展开项目...

So far I've tried Enable(true) and EnableActiveAccessibility() but those doesn't seem to work... 到目前为止,我已经尝试过Enable(true)EnableActiveAccessibility()但是它们似乎不起作用...

Any idea which property I should set? 知道应该设置哪个属性?

Thanks! 谢谢!

It's not very obvious, but you need to call CMFCPropertyGridProperty::Expand with the bExpand parameter as FALSE! 这不是很明显,但是您需要使用bExpand参数为FALSE来调用CMFCPropertyGridProperty :: Expand

Parameters [in] bExpand TRUE to expand the property; 参数[in] bExpand TRUE,以扩展属性; FALSE to collapse the property. FALSE会使财产倒塌。 The default value is TRUE. 默认值是true。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM