1 #pragma once 2 #include "IconMgr.h" 3 4 class CStaticEx : 5 public CStatic 6 { 7 public: 8 CStaticEx(); 9 ~CStaticEx(); 10 11 void SetTextColor(COLORREF text_color); 12 void SetBackgroundColor(COLORREF back_color); 13 void SetWindowText(LPCTSTR lpszString); 14 CString GetWindowText() const; 15 void SetIcon(IconMgr::IconType icon_type); //设置在文本前面的图标 16 17 private: 18 COLORREF m_text_color{ GRAY(0) }; 19 COLORREF m_back_color{ GRAY(255) }; 20 bool m_transparent{ true }; 21 IconMgr::IconType m_icon_type = IconMgr::IconType::IT_NO_ICON; 22 23 public: 24 DECLARE_MESSAGE_MAP() 25 afx_msg void OnPaint(); 26 }; 27 28