// 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 ;
}

MFC下的日历表的更多相关文章

  1. MFC下OpenGL入门(可以用)

    MFC下OpenGL入门 源文件 1, 建一工程文件,我这里命名为first,现在first工程里面我们没有添加任何东西,所有的东西都是MFC自动帮我们创建的. 2, 添加链接库.这一步很关键.打开菜 ...

  2. MFC下调用控制台和控制台下MFC库的支持

    1.MFC下调用控制台 在CWinApp的InitInstance中对话框的DoModal之前加入 AllocConsole(); // 开辟控制台 SetConsoleTitle(_T(" ...

  3. MFC下的各种字符串类型和相互转换

    MFC下的常用字符串数据类型表示的含义: L:Long  长 P:Point  指针 C:Const  常量 W:Wchar_t  宽字符 T:TCHAR  STR:String  字符串 在看看MF ...

  4. [Sciter系列] MFC下的Sciter–5.Sciter中GUI线程研究

    [Sciter系列] MFC下的Sciter–5.Sciter中GUI线程研究,目前MFC存在问题,win32没问题. 本系列文章的目的就是一步步构建出一个功能可用,接口基本完善的基于MFC框架的Sc ...

  5. [Sciter系列] MFC下的Sciter–4.HTML与图片资源内置

    [Sciter系列] MFC下的Sciter–4.HTML与图片资源内置,防止代码泄露. 本系列文章的目的就是一步步构建出一个功能可用,接口基本完善的基于MFC框架的SciterFrame程序,以此作 ...

  6. [Sciter系列] MFC下的Sciter–3.Sciter脚本与底层交互

    [Sciter系列] MFC下的Sciter–3.Sciter脚本与底层交互,脚本调用底层自定义的方法函数. 本系列文章的目的就是一步步构建出一个功能可用,接口基本完善的基于MFC框架的SciterF ...

  7. [Sciter系列] MFC下的Sciter–2.Sciter中的事件,tiscript,语法

    [Sciter系列] MFC下的Sciter–2.Sciter中的事件,tiscript,CSS部分自觉学习,重点说明Tiscript部分的常见语法和事件用法. 本系列文章的目的就是一步步构建出一个功 ...

  8. VC/MFC 下 递归遍历目录下的所有子目录及文件

    在MFC下要实现文件夹的递归遍历,可用CFileFind类,依次读取文件夹下的子文件夹和文件,并判断通过判断是文件夹还是文件来决定递归遍历.递归遍历代码如下: /******************* ...

  9. MFC下MCI的使用播放音乐

    最近研究了一下MFC下的音乐的播放,主要使用了MCI 1.需要包含的库文件 在链接资源里(link)添加库文件VFW32.lib winmm.lib 2.包含的头文件 #include <mms ...

随机推荐

  1. 说一说Servlet 的生命周期

    答:servlet 有良好的生存期的定义, 包括加载和实例化. 初始化. 处理请求以及服务结束.这个生存期由 javax.servlet.Servlet 接口的 init,service 和 dest ...

  2. JavaSE学习总结第27天_反射 & 设计模式 & JDK5、7、8新特性

      27.01  反射_类的加载概述和加载时机 类的加载:当程序要使用某个类时,如果该类还未被加载到内存中,则系统会通过加载,连接,初始化三步来实现对这个类进行初始化. 加载:就是指将class文件读 ...

  3. HDU2008-数值统计

    描述: 统计给定的n个实数中,负数.零和正数的个数. 代码: #include<stdio.h> #include<string.h> #include<iostream ...

  4. selenium + python自动化测试环境搭建--亲测

    环境准备: 1.下载所学安装包: setuptools https://pypi.python.org/packages/2.7/s/setuptools/ selenium https://pypi ...

  5. 使用Lock实现信号量

    public class SemaphoreOnLock {     private final Lock lock = new ReentrantLock();         private fi ...

  6. 1005 - Rooks(规律)

    1005 - Rooks   PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 32 MB A rook is ...

  7. 关于SpringMVC中找不到<mvc:resources/>标签的解决办法

    在springMVC中我们经常会用到<mvc:resources/>标签,但是有些编辑器中的schema过于陈旧.导致找不到<mvc:resources/>标签. 经过试验,有 ...

  8. C#多线程编程简述

    NET将关于多线程的功能定义在System.Threading名字空间中.因此,要使用多线程,必须先声明引用此名字空间(using System.Threading;). a.启动线程顾名思义,“启动 ...

  9. mobilize扁平化的fullPage.js类工具使用心得

    可以生成一个fullPage效果的主页,但是列表页面和内容页面呢? 主页中的block,可以选择多种组建生成.甚至连form都有: 应该改造其源代码,动态化和cms系统化,添加二三级页面模板: == ...

  10. iOS推送介绍

    iOS消息推送的工作机制可以简单的用下图来概括: Provider是指某个iPhone软件的Push服务器,APNS是Apple Push Notification Service的缩写,是苹果的服务 ...