MFC下的日历表
// 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下的日历表的更多相关文章
- MFC下OpenGL入门(可以用)
MFC下OpenGL入门 源文件 1, 建一工程文件,我这里命名为first,现在first工程里面我们没有添加任何东西,所有的东西都是MFC自动帮我们创建的. 2, 添加链接库.这一步很关键.打开菜 ...
- MFC下调用控制台和控制台下MFC库的支持
1.MFC下调用控制台 在CWinApp的InitInstance中对话框的DoModal之前加入 AllocConsole(); // 开辟控制台 SetConsoleTitle(_T(" ...
- MFC下的各种字符串类型和相互转换
MFC下的常用字符串数据类型表示的含义: L:Long 长 P:Point 指针 C:Const 常量 W:Wchar_t 宽字符 T:TCHAR STR:String 字符串 在看看MF ...
- [Sciter系列] MFC下的Sciter–5.Sciter中GUI线程研究
[Sciter系列] MFC下的Sciter–5.Sciter中GUI线程研究,目前MFC存在问题,win32没问题. 本系列文章的目的就是一步步构建出一个功能可用,接口基本完善的基于MFC框架的Sc ...
- [Sciter系列] MFC下的Sciter–4.HTML与图片资源内置
[Sciter系列] MFC下的Sciter–4.HTML与图片资源内置,防止代码泄露. 本系列文章的目的就是一步步构建出一个功能可用,接口基本完善的基于MFC框架的SciterFrame程序,以此作 ...
- [Sciter系列] MFC下的Sciter–3.Sciter脚本与底层交互
[Sciter系列] MFC下的Sciter–3.Sciter脚本与底层交互,脚本调用底层自定义的方法函数. 本系列文章的目的就是一步步构建出一个功能可用,接口基本完善的基于MFC框架的SciterF ...
- [Sciter系列] MFC下的Sciter–2.Sciter中的事件,tiscript,语法
[Sciter系列] MFC下的Sciter–2.Sciter中的事件,tiscript,CSS部分自觉学习,重点说明Tiscript部分的常见语法和事件用法. 本系列文章的目的就是一步步构建出一个功 ...
- VC/MFC 下 递归遍历目录下的所有子目录及文件
在MFC下要实现文件夹的递归遍历,可用CFileFind类,依次读取文件夹下的子文件夹和文件,并判断通过判断是文件夹还是文件来决定递归遍历.递归遍历代码如下: /******************* ...
- MFC下MCI的使用播放音乐
最近研究了一下MFC下的音乐的播放,主要使用了MCI 1.需要包含的库文件 在链接资源里(link)添加库文件VFW32.lib winmm.lib 2.包含的头文件 #include <mms ...
随机推荐
- Spring集成log4j日志管理
原文地址:http://blog.csdn.net/naruto1021/article/details/7969535 在使用Spring框架的时候,我们可以很方便的配置log4j来进行日志管理. ...
- C# Mutex
Mutex Mutex 类似于C# lock, 区别在于一个Mutex可以在多个进程间使用.也就是说Mutex既是computer-wide又是application-wide. 注意: 获取和释放M ...
- 帝国cms栏目死变量
这里为帝国学习者们放出帝国学习者们会用到的栏目死变量,不需要灵动或者万能标签能调用,在任何位置都能使用 栏目路径:<?=$public_r[newsurl].$class_r[1]['class ...
- Java算法——O(n)查询数列中出现超过半数的元素
主要思想: 相邻元素两两比较,如果相同存入新数组,不同二者都删除.如果 某数出现次数超高n/2,则最后剩下的1元素为所求. public static int findMostElem(final A ...
- 进一步探索:Windows Azure 网站中解锁的配置选项
编辑人员注释: 本文章由 Windows Azure 网站团队的项目经理 Erez Benari 撰写. 在 Windows Azure 网站 (WAWS) 中管理网站时,许多选项可使用 Azu ...
- Special Subsequence(离散化线段树+dp)
Special Subsequence Time Limit: 5 Seconds Memory Limit: 32768 KB There a sequence S with n inte ...
- CF-192-diy-2
题目链接: http://codeforces.com/contest/330 A. Cakeminator 题目意思: 给一个r*c的矩阵方格,有些位置有S,如果某一行和一列都不含标记为S的方格,则 ...
- c 按输入的字母来输出对应效果
输入一个大写字母,如 F,输出 比如: 输入:F 输出: F EFE DEFED CDEFEDC BCDEFEDCB ABCDEFEDCBA #include<stdio.h> int m ...
- 读书笔记之MERGE 语句使用
常用语法 MERGE INTO <target table> AS TGT USING <SOURCE TABLE> AS SRC ON <merge predicate ...
- linux命令: patch
一. 针对单文件的patch: 我们以mkprj.sh.1和mkprj.sh两个文件为例: [root@localhost tst]# lsmkprj.sh.1 mkprj.sh 看两个文件的差异: ...