DigitalClock.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /********************************************************************************
  2. File: DigitalClock.h"
  3. Author: Mt.Hu (hmt-abc@163.com)
  4. Date: 2008/4/28
  5. Note: Please include the comment if you use the file in your project
  6. ********************************************************************************/
  7. #if !defined(AFX_DIGITALCLOCK_H__6308EC19_76C9_4BE5_8F53_B4DBB7B11340__INCLUDED_)
  8. #define AFX_DIGITALCLOCK_H__6308EC19_76C9_4BE5_8F53_B4DBB7B11340__INCLUDED_
  9. #if _MSC_VER > 1000
  10. #pragma once
  11. #endif // _MSC_VER > 1000
  12. #define ALIGN_LEFT 0;
  13. #define ALIGN_CENTER 1;
  14. #define ALIGN_RIGHT 2;
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CDigitalClock window
  17. class CDigitalClock : public CStatic
  18. {
  19. // Construction
  20. public:
  21. CDigitalClock();
  22. // Attributes
  23. public:
  24. // Operations
  25. public:
  26. // Overrides
  27. // ClassWizard generated virtual function overrides
  28. //{{AFX_VIRTUAL(CDigitalClock)
  29. //}}AFX_VIRTUAL
  30. // Implementation
  31. public:
  32. virtual ~CDigitalClock();
  33. COLORREF GetTextColor();
  34. COLORREF GetBkColor();
  35. int GetSpace();
  36. int GetAlign();
  37. void SetClock(int nHour,int nMinute,int nSecond);
  38. void SetSpace(int nSpace);
  39. void SetTextColor(COLORREF crText);
  40. void SetBkColor(COLORREF crBk);
  41. void SetAlign(int nAlign);
  42. // Generated message map functions
  43. protected:
  44. //{{AFX_MSG(CDigitalClock)
  45. afx_msg void OnPaint();
  46. //}}AFX_MSG
  47. DECLARE_MESSAGE_MAP()
  48. private:
  49. void DrawSection1(int nLeft);
  50. void DrawSection2(int nLeft);
  51. void DrawSection3(int nLeft);
  52. void DrawSection4(int nLeft);
  53. void DrawSection5(int nLeft);
  54. void DrawSection6(int nLeft);
  55. void DrawSection7(int nLeft);
  56. void Draw2Dot(int nLeft);
  57. void DrawSingleNumber(int nNum,int nLeft);
  58. void DrawHour();
  59. void DrawMinute();
  60. void DrawSecond();
  61. void DrawTimer();
  62. COLORREF m_crText;
  63. COLORREF m_crBk;
  64. CRect m_rect;
  65. CDC m_memDC;
  66. int m_nAlign;
  67. int m_nWidth;
  68. int m_nHour;
  69. int m_nMinute;
  70. int m_nSecond;
  71. int m_nSpace;
  72. int m_nXmargin;
  73. int m_nYmargin;
  74. };
  75. /////////////////////////////////////////////////////////////////////////////
  76. //{{AFX_INSERT_LOCATION}}
  77. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  78. #endif // !defined(AFX_DIGITALCLOCK_H__6308EC19_76C9_4BE5_8F53_B4DBB7B11340__INCLUDED_)