只会用最简单的AddOption增加一项,AllowEdit设置可输入求指教

解决方案 »

  1.   

    可以试试从 CMFCPropertyGridProperty 派生新类, 然后重载的 CreateCombo 函数, 这样可以创建自己的ComboBox, class CMyMFCPropertyGridProperty : public CMFCPropertyGridProperty
    {
    public:
      CMyMFCPropertyGridProperty(const CString& strName, const COleVariant& varValue, LPCTSTR lpszDescr = NULL)
        :CMFCPropertyGridProperty(strName, varValue, lpszDescr, 0, NULL, NULL, NULL)
      {
      }
      virtual CComboBox* CreateCombo(CWnd* pWndParent, CRect rect)
      {
        ASSERT_VALID(this);    rect.bottom = rect.top + 400;    CMyComboBox* pWndCombo = new CMyComboBox; //CMyComboBox 派生自 CComboBox
        if (!pWndCombo->Create(WS_CHILD | CBS_NOINTEGRALHEIGHT | CBS_DROPDOWN | WS_VSCROLL,
          rect, pWndParent, AFX_PROPLIST_ID_INPLACE))
        {
          delete pWndCombo;
          return NULL;
        }    return pWndCombo;
      }
    };