1 #pragma once 2 #include "BaseDialog.h" 3 #include "ListCtrlEx.h" 4 5 6 // CSimplePropertiesDlg 对话框 7 8 class CSimplePropertiesDlg : public CBaseDialog 9 { 10 DECLARE_DYNAMIC(CSimplePropertiesDlg) 11 12 public: 13 CSimplePropertiesDlg(CWnd* pParent = nullptr); // 标准构造函数 14 virtual ~CSimplePropertiesDlg(); 15 16 // 对话框数据 17 #ifdef AFX_DESIGN_TIME 18 enum { IDD = IDD_SELECT_ITEM_DIALOG }; 19 #endif 20 21 protected: 22 //对话框中每一行的内容 23 struct Item 24 { 25 std::wstring label; //标签的文本 26 std::wstring value; //值的文本 27 ItemItem28 Item() {} ItemItem29 Item(const std::wstring& _label, const std::wstring& _value) 30 : label(_label), value(_value) 31 {} 32 }; 33 34 std::vector<Item> m_items; 35 36 //派生类中需要实现此函数,并向m_items中添加数据 37 virtual void InitData() = 0; 38 39 private: 40 CListCtrlEx m_list_ctrl; 41 42 virtual bool InitializeControls() override; 43 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 44 45 DECLARE_MESSAGE_MAP() 46 public: 47 virtual BOOL OnInitDialog(); 48 }; 49