CMFCPropertyGridCtrl 使用简记


CMFCPropertyGridCtrl vc2008 新增加类使用方法:

创建:CMFCPropertyGridCtrl m_wndPropList ;
CRect rectDummy;
rectDummy.SetRectEmpty ();
if (!m_wndPropList .Create (WS_VISIBLE | WS_CHILD, rectDummy, this, 1))
{
   TRACE0("Failed to create Properies Grid /n");
   return -1;       // fail to create
}

m_wndPropList.EnableHeaderCtrl (FALSE);//标头
m_wndPropList.EnableDescriptionArea ();//
m_wndPropList.SetVSDotNetLook ();//

增加项:

CMFCPropertyGridProperty* pMDITabsProp = new CMFCPropertyGridProperty (_T("Enable MDI Tabs"), 
   lpszMDITabsStyles [1],
   _T("Enable or disable either the standard MDI Tabs feature, or MDI Tabbed Groups feature"), 
   idShowMDITabs);
pMDITabsProp->AddOption (_T ("None"));
pMDITabsProp->AddOption (_T ("MDI Tabs (Standard)"));
pMDITabsProp->AddOption (_T ("MDI Tabbed Groups"));
m_wndPropList.AddProperty (pMDITabsProp);

得到一项值:

CMFCPropertyGridProperty*   m_pro = m_wndPropList ->GetProperty( int nIndex ) ;
CString str = m_pro ->GetValue();
回调方法:

afx_msg LRESULT OnPropertyChanged (WPARAM,LPARAM);

ON_REGISTERED_MESSAGE(AFX_WM_PROPERTY_CHANGED, OnPropertyChanged)

LRESULT CWorkspaceBar::OnPropertyChanged (WPARAM,LPARAM lParam)
{
CMFCPropertyGridProperty* pProp = (CMFCPropertyGridProperty*) lParam;
BOOL bResetMDIChild = FALSE;
switch ((int) pProp->GetData ())
{
   case :pProp->GetValue(); break ;
   }

}

http://qzone.qq.com/blog/4666942-1230445980
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值