// 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. myeclipse优化设置

    一.myeclipse字体设置Window->Preferences->General->Appearance->Colors and Fonts在右侧找到”Aa Test F ...

  2. BZOJ 1097: [POI2007]旅游景点atr( 最短路 + 状压dp )

    先最短路预处理, 然后状压就行了 -------------------------------------------------------------------------- #include ...

  3. BZOJ 1649: [Usaco2006 Dec]Cow Roller Coaster( dp )

    有点类似背包 , 就是那样子搞... --------------------------------------------------------------------------------- ...

  4. mysql 组合索引

    MySQL单列索引是我们使用MySQL数据库中经常会见到的,MySQL单列索引和组合索引的区别可能有很多人还不是十分的了解,下面就为您分析两者的主要区别,供您参考学习. 为了形象地对比两者,再建一个表 ...

  5. sourceTree安装与使用

    1,下载并安装 sourceTree http://downloads.atlassian.com/software/sourcetree/windows/SourceTreeSetup_1.6.14 ...

  6. IOS 学习笔记(3) 视图UITabbarController

    1.UITabbarViewController标签试图控制器.由于标签页本就起着分类的作用,所以往往呈现的视图内容之间,可以是毫不相关的功能. UITabbarViewController仍然继承自 ...

  7. 读取IOS的相应路径

    //    IOS相应路径 NSString* bundlePath = [[NSBundle mainBundle] bundlePath]; NSLog(@"bundlePath = % ...

  8. ISO14443 ISO15693 ISO18000

    [提要]射频标签的通信标准是标签芯片设计的依据,目前国际上与RFID相关的通信标准主要有:ISO/IEC 18000标准(包括7个部分,涉及125KHz, 13.56MHz, 433MHz, 860- ...

  9. 完成端口(Completion Port)详解(超级长,超级清楚)

    http://www.cnblogs.com/lancidie/archive/2011/12/19/2293773.html

  10. Airport(未解决。。。)

    Airport Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Sub ...