CalendarFrm.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /***************************************************************************
  2. 致看到这些源代码的兄弟:
  3. 你好!
  4. 这本来是我为一个商业PDA产品开发的日历程序,最近移植于PC机上, 所以算法
  5. 和数据部分是用纯C++写的,不涉及MFC,所有的代码都是以短节省存储空间为主要目
  6. 的.
  7. 很高兴你对这些代码有兴趣,你可以随意复制和使用些代码,唯一有一点小小的
  8. 愿望:在你使用和复制给别人时,别忘注明这些代码作者:-)。程序代码也就罢了,后
  9. 面的数据可是我辛辛苦苦从万年历上找出来输进去的。
  10. 如果你有什么好的意见不妨Mail给我。
  11. wangfei@hanwang.com.cn
  12. wangfei@engineer.com.cn
  13. ****************************************************************************/
  14. #if !defined(AFX_CALENDARFRM_H__9EC203BC_1574_4986_B73C_A44C975739CC__INCLUDED_)
  15. #define AFX_CALENDARFRM_H__9EC203BC_1574_4986_B73C_A44C975739CC__INCLUDED_
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif // _MSC_VER > 1000
  19. #include "Calendar1.h"
  20. // CalendarFrm.h : header file
  21. // Download by http://www.codefans.net
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CCalendarFrm window
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CYearEdit window
  26. class CYearEdit : public CEdit
  27. {
  28. // Construction
  29. public:
  30. CYearEdit();
  31. // Attributes
  32. public:
  33. // Operations
  34. public:
  35. // Overrides
  36. // ClassWizard generated virtual function overrides
  37. //{{AFX_VIRTUAL(CYearEdit)
  38. public:
  39. virtual BOOL Create(const RECT& rect, CWnd* pParentWnd, UINT nID);
  40. //}}AFX_VIRTUAL
  41. // Implementation
  42. public:
  43. virtual ~CYearEdit();
  44. // Generated message map functions
  45. protected:
  46. //{{AFX_MSG(CYearEdit)
  47. afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  48. afx_msg void OnKillFocus(CWnd* pNewWnd);
  49. //}}AFX_MSG
  50. DECLARE_MESSAGE_MAP()
  51. };
  52. class CCalendarFrm : public CWnd // Jeff摄控本图表;
  53. {
  54. private:
  55. CFont m_oDispFont;
  56. // Construction
  57. public:
  58. CCalendar m_oCalendar;
  59. CCalendarFrm();
  60. void DateChange(LONG iYear, LONG iMonth);
  61. void DateChange2(LONG iYear, LONG iMonth, LONG iDay);
  62. CRect m_rect;
  63. // Attributes
  64. public:
  65. void SetDate(WORD iYear, WORD iMonth, WORD iDay)
  66. {
  67. m_oCalendar.SetDate(iYear, iMonth, iDay);
  68. }
  69. void GetDate(WORD &iYear, WORD &iMonth, WORD &iDay)
  70. {
  71. m_oCalendar.GetDate(iYear, iMonth, iDay);
  72. }
  73. CFont * GetDispFont(){return &m_oDispFont;}
  74. public:
  75. virtual BOOL Create(RECT &rect, CWnd * pParentWnd, UINT nID); // Jeff
  76. virtual ~CCalendarFrm();
  77. // Generated message map functions
  78. private:
  79. void l_PaintToday(CPaintDC &dc);
  80. void l_PaintBorder(CPaintDC &dc);
  81. void l_PaintChineseInfo(CPaintDC &dc);
  82. void l_CreateDispFont();
  83. protected:
  84. afx_msg void OnPaint();
  85. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  86. //}}AFX_MSG
  87. #ifdef VC60
  88. afx_msg void OnSelChange(LONG iYearMonth, LONG iDay);
  89. #else
  90. afx_msg LRESULT OnSelChange(WPARAM wp, LPARAM lp);
  91. #endif
  92. afx_msg void OnMonthChange();
  93. afx_msg void OnYearChange();
  94. afx_msg void OnTodayClick();
  95. DECLARE_MESSAGE_MAP()
  96. };
  97. #endif