MFC下的日历表 (一)

2014-11-23 22:54:05 · 作者: · 浏览: 10
// CalenderDlg.h : header file
//

#if !defined(AFX_CALENDERDLG_H__8DC8F113_2A47_45B8_8266_75CB406D687B__INCLUDED_)
#define AFX_CALENDERDLG_H__8DC8F113_2A47_45B8_8266_75CB406D687B__INCLUDED_
#include"resource.h"
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include"MyTime.h"
/////////////////////////////////////////////////////////////////////////////
// CCalenderDlg dialog

class CCalenderDlg : public CDialog
{
// Construction
public:
	CCalenderDlg(CWnd* pParent = NULL);	// standard constructor
	
// Dialog Data
	//{{AFX_DATA(CCalenderDlg)
	enum { IDD = IDD_CALENDER_DIALOG };
	CStatic	m_StaticShowTime;
	CButton	m_b35;
	CButton	m_b34;
	CButton	m_b33;
	CButton	m_b32;
	CButton	m_b31;
	CButton	m_b30;
	CButton	m_b29;
	CButton	m_b28;
	CButton	m_b27;
	CButton	m_b26;
	CButton	m_b25;
	CButton	m_b24;
	CButton	m_b23;
	CButton	m_b22;
	CButton	m_b21;
	CButton	m_b20;
	CButton	m_b19;
	CButton	m_b1b8;
	CButton	m_b17;
	CButton	m_b16;
	CButton	m_b15;
	CButton	m_b14;
	CButton	m_b13;
	CButton	m_b12;
	CButton	m_11;
	CButton	m_b10;
	CButton	m_b9;
	CButton	m_b8;
	CButton	m_b7;
	CButton	m_b6;
	CButton	m_b5;
	CButton	m_b4;
	CButton	m_b3;
	CButton	m_b2;
	CButton	m_b1;
	CMonthCalCtrl	m_MonthCalCtrl;
	CListBox	m_ListBox;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CCalenderDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CCalenderDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnGetdaystateMonthcalendar3(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnGo();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	void setTimeToday();
	MyTime mt ;
	CMenu myMenu ;
	int year , mouth , day ;
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual 
C++
will insert additional declarations immediately before the previous line. #endif // !defined(AFX_CALENDERDLG_H__8DC8F113_2A47_45B8_8266_75CB406D687B__INCLUDED_)
// MyTime.cpp: implementation of the MyTime class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Calender.h"
#include "MyTime.h"
#include
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

MyTime::MyTime()
{
	time_t now;
	struct tm*fmt;
	time(&now);
	fmt=localtime(&now);
    year=1900+fmt->tm_year; 
	month=1+fmt->tm_mon;    
	day=fmt->tm_mday;     
}

MyTime::~MyTime()
{

}
bool MyTime::fun(int y){
	if ((y%4==0)&&(y%100!=0)||(y%400==0))   return true ;
	return false;
}
int MyTime::sum(int y,int m){
	int sum=0;
    for(int j=1992;j 
 
// SetTime.cpp : implementation file
//

#include "stdafx.h"
#include "Calender.h