LABEL.H 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /**************************************************************************************************
  2. 版本所有(C), 2020-2022, 北京普达迪泰
  3. ***************************************************************************************************
  4. 文 件 名: Label.h
  5. 功能描述: 自定义UI上的文本标签
  6. 版 本 号: 1.00初版
  7. 作 者: HYF
  8. 生成日期; 2021-12-20
  9. 最近修改:
  10. 函数列表:
  11. 修改历史:
  12. 1.日 期 :2021-12-20
  13. 作 者 : HYF
  14. 修改内容 : 创建文件
  15. **************************************************************************************************/
  16. #if !defined(AFX_LABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_)
  17. #define AFX_LABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_
  18. #if _MSC_VER >= 1000
  19. #pragma once
  20. #endif // _MSC_VER >= 1000
  21. // Label.h : header file
  22. //
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CLabel window
  25. enum FlashType {None, Text, Background };
  26. class CLabel : public CStatic
  27. {
  28. // Construction
  29. public:
  30. CLabel();
  31. CLabel& SetBkColor(COLORREF crBkgnd);
  32. CLabel& SetTextColor(COLORREF crText);
  33. CLabel& SetText(const CString& strText);
  34. CLabel& SetFontBold(BOOL bBold);
  35. CLabel& SetFontName(const CString& strFont);
  36. CLabel& SetFontUnderline(BOOL bSet);
  37. CLabel& SetFontItalic(BOOL bSet);
  38. CLabel& SetFontSize(int nSize);
  39. CLabel& SetSunken(BOOL bSet);
  40. CLabel& SetBorder(BOOL bSet);
  41. CLabel& FlashText(BOOL bActivate);
  42. CLabel& FlashBackground(BOOL bActivate);
  43. CLabel& SetLink(BOOL bLink);
  44. CLabel& SetLinkCursor(HCURSOR hCursor);
  45. CLabel& SetTransparent(BOOL bRet);
  46. // Attributes
  47. public:
  48. protected:
  49. void ReconstructFont();
  50. COLORREF m_crText;
  51. HBRUSH m_hBrush;
  52. HBRUSH m_hwndBrush;
  53. LOGFONT m_lf;
  54. CFont m_font;
  55. CString m_strText;
  56. BOOL m_bState;
  57. BOOL m_bTimer;
  58. BOOL m_bLink;
  59. FlashType m_Type;
  60. HCURSOR m_hCursor;
  61. BOOL m_bTrans; //透明背景
  62. public:
  63. // Overrides
  64. // ClassWizard generated virtual function overrides
  65. //{{AFX_VIRTUAL(CLabel)
  66. //}}AFX_VIRTUAL
  67. // Implementation
  68. public:
  69. virtual ~CLabel();
  70. // Generated message map functions
  71. protected:
  72. //{{AFX_MSG(CLabel)
  73. afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
  74. afx_msg void OnTimer(UINT_PTR nIDEvent);
  75. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  76. afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  77. //}}AFX_MSG
  78. DECLARE_MESSAGE_MAP()
  79. };
  80. /////////////////////////////////////////////////////////////////////////////
  81. //{{AFX_INSERT_LOCATION}}
  82. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  83. #endif // !defined(AFX_LABEL_H__A4EABEC5_2E8C_11D1_B79F_00805F9ECE10__INCLUDED_)