// 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类

// MyTime.cpp: implementation of the MyTime class.
//
////////////////////////////////////////////////////////////////////// #include "stdafx.h"
#include "Calender.h"
#include "MyTime.h"
#include<ctime>
#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<y;j++)
fun(j)?sum+=366:sum+=365;
for(int i=1;i<m;i++)
sum+=mouth(i);
return sum;
} int MyTime::mouth(int m)
{
if((m==4)||(m==6)||(m==9)||(m==11)) return 30;
if((m==2)&&(fun(year))) return 29;
if((m==2)&&(!fun(year))) return 28;
return 31;
}
int MyTime::getYear(){
return year;
}
int MyTime::getMouth(){
return month;
}
int MyTime::getDay(){
return day ;
}
void MyTime::setYear(int y){
year = y ;
}
void MyTime::setMouth(int m){
month = m ;
}
void MyTime::setDay(int d){
day = d ;
}

setTime类

// SetTime.cpp : implementation file
// #include "stdafx.h"
#include "Calender.h"
#include "SetTime.h" #ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif /////////////////////////////////////////////////////////////////////////////
// SetTime dialog SetTime::SetTime(CWnd* pParent /*=NULL*/)
: CDialog(SetTime::IDD, pParent)
{
//{{AFX_DATA_INIT(SetTime)
m_strYear = _T("");
//}}AFX_DATA_INIT
} void SetTime::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SetTime)
DDX_Control(pDX, IDC_EDIT2, m_editMouth);
DDX_Text(pDX, IDC_EDIT1, m_strYear);
//}}AFX_DATA_MAP
} BEGIN_MESSAGE_MAP(SetTime, CDialog)
//{{AFX_MSG_MAP(SetTime)
//}}AFX_MSG_MAP
END_MESSAGE_MAP() /////////////////////////////////////////////////////////////////////////////
// SetTime message handlers void SetTime::OnOK()
{
// TODO: Add extra validation here
CString tempMouth , tempDay ;
UpdateData();
year=_ttoi(m_strYear); m_editMouth.GetWindowText(tempMouth);
mouth=_ttoi(tempMouth); CWnd * cw =GetDlgItem(IDC_EDIT3);
cw->GetWindowText(tempDay);
day = _ttoi(tempDay); CDialog::OnOK();
}
int SetTime::getYear(){
return year ;
}
int SetTime::getMouth(){
return mouth ;
}
int SetTime::getDay(){
return day ;
}

最新文章

  1. python列表模拟堆栈和队列
  2. Mysql数据库的使用总结之Innodb简介
  3. JavaScript 中一些概念理解 :clientX、clientY、offsetX、offsetY、screenX、screenY
  4. RPM包管理命令rpm
  5. 【13_263】Ugly Number
  6. Win2008上.NET4.0部署出错HTTP 错误 500.21 - Internal Server Error的解决方法
  7. 使用Java API创建(create),查看(describe),列举(list),删除(delete)Kafka主题(Topic)
  8. HW6.20
  9. MySQL主主复制+LVS+Keepalived实现MySQL高可用性1
  10. PHP文件目录copy
  11. java面向对象--包及访问控制符
  12. 什么是 stack?- 每天5分钟玩转 Docker 容器技术(111)
  13. css挖坑爬坑之div高宽相等
  14. Python 中if __name__ == &#39;__main__&#39;: 的作用和原理
  15. pythonのscrapy抓取网站数据
  16. Python学习(七) —— 装饰器、迭代器、生成器
  17. spring boot 整合freemarker(好用!!!!)
  18. TCP之 TIME_WAIT和CLOSE_WAIT 状态 的原因分析和处理
  19. MSDN离线版 发现不少人都在找这个
  20. centos7.4应用之KVM

热门文章

  1. 利用Apperance协议定义View的全局外观
  2. Python TypeError: not enough arguments for format string
  3. 梳理下phpmyadmin改root密码后登录不上的问题。
  4. monkeyrunner环境搭建
  5. 高性能javascript 学习笔记(1)
  6. python之math模块
  7. 将默认首页设置成index.do的方法
  8. JBoss Jopr
  9. Linux的默认编码可以通过export LC_ALL=zh_CN.GBK来修改
  10. 手工部署Sqlserver CLR程序集