1 #pragma once 2 class CMyComboBox : public CComboBox 3 { 4 DECLARE_DYNAMIC(CMyComboBox) 5 6 public: 7 CMyComboBox(); 8 virtual ~CMyComboBox(); 9 10 void SetReadOnly(bool read_only = true); 11 void SetEditReadOnly(bool read_only = true); 12 CEdit* GetEditCtrl(); 13 CString GetText(); 14 void ResetModified(); 15 void SetModify(); 16 void SetMouseWheelEnable(bool enable); //设置是否允许响应鼠标滚轮 17 18 protected: 19 bool m_read_only{ false }; 20 CRect m_arrow_rect; //下拉箭头的矩形区域 21 bool m_modified{}; 22 bool m_mouse_wheel_enable{ true }; 23 24 public: 25 DECLARE_MESSAGE_MAP() 26 virtual BOOL PreTranslateMessage(MSG* pMsg); 27 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); 28 afx_msg BOOL OnCbnSelchange(); 29 protected: 30 afx_msg LRESULT OnTabletQuerysystemgesturestatus(WPARAM wParam, LPARAM lParam); 31 }; 32 33