日程备忘录实习报告Word格式.docx
- 文档编号:19051099
- 上传时间:2023-01-03
- 格式:DOCX
- 页数:13
- 大小:38.62KB
日程备忘录实习报告Word格式.docx
《日程备忘录实习报告Word格式.docx》由会员分享,可在线阅读,更多相关《日程备忘录实习报告Word格式.docx(13页珍藏版)》请在冰豆网上搜索。
"
);
//}}AFX_DATA_INIT
//NotethatLoadIcondoesnotrequireasubsequentDestroyIconinWin32
m_hIcon=AfxGetApp()->
LoadIcon(IDR_MAINFRAME);
}
voidCRichengDlg:
DoDataExchange(CDataExchange*pDX)
CDialog:
DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRichengDlg)
DDX_Control(pDX,IDC_STATIC1,m_num);
DDX_Control(pDX,IDC_LIST1,m_listc);
DDX_DateTimeCtrl(pDX,IDC_DATETIMEPICKER1,m_date);
DDX_DateTimeCtrl(pDX,IDC_DATETIMEPICKER2,m_time);
DDX_Text(pDX,IDC_EDIT1,m_event);
//}}AFX_DATA_MAP
BEGIN_MESSAGE_MAP(CRichengDlg,CDialog)
//{{AFX_MSG_MAP(CRichengDlg)
ON_WM_SYSCOMMAND()//消息映射定义
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1,Ontianjia)
ON_NOTIFY(NM_CLICK,IDC_LIST1,OnClickList1)
ON_MESSAGE(WM_NC,OnNotifyIcon)
ON_WM_TIMER()
ON_NOTIFY(NM_RCLICK,IDC_LIST1,OnRclickList1)
ON_COMMAND(IDS_menu,Onmenu)
ON_BN_CLICKED(IDC_STATIC2,Onlink)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//CRichengDlgmessagehandlers
BOOLCRichengDlg:
OnInitDialog()
OnInitDialog();
num=0;
//列表初始化
CStringmm;
mm.Format("
共有记录%d条"
num);
m_num.SetWindowText(mm);
DWORDdwStyle;
dwStyle=m_listc.GetStyle();
dwStyle|=LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT|LVS_SHOWSELALWAYS;
m_listc.SetExtendedStyle(dwStyle);
m_listc.SetBkColor(RGB(234,234,234));
m_listc.SetTextBkColor(RGB(221,221,221));
m_listc.InsertColumn(0,"
时间"
LVCFMT_LEFT,168);
m_listc.InsertColumn(1,"
待办事务"
LVCFMT_LEFT,237);
SetTimer(1,1000,NULL);
//设定计时器
//Add"
About..."
menuitemtosystemmenu.
//IDM_ABOUTBOXmustbeinthesystemcommandrange.
ASSERT((IDM_ABOUTBOX&
0xFFF0)==IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX<
0xF000);
CMenu*pSysMenu=GetSystemMenu(FALSE);
if(pSysMenu!
=NULL)
{
CStringstrAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if(!
strAboutMenu.IsEmpty())
{
pSysMenu->
AppendMenu(MF_SEPARATOR);
AppendMenu(MF_STRING,IDM_ABOUTBOX,strAboutMenu);
}
}
//Settheiconforthisdialog.Theframeworkdoesthisautomatically
//whentheapplication'
smainwindowisnotadialog
SetIcon(m_hIcon,TRUE);
//Setbigicon
SetIcon(m_hIcon,FALSE);
//Setsmallicon
//TODO:
Addextrainitializationhere
returnTRUE;
//returnTRUEunlessyousetthefocustoacontrol
OnSysCommand(UINTnID,LPARAMlParam)
if((nID&
0xFFF0)==IDM_ABOUTBOX)
CAboutDlgdlgAbout;
dlgAbout.DoModal();
elseif((nID&
0xFFF0)==SC_MINIMIZE)
toTray();
//放入托盘的函数
else
CDialog:
OnSysCommand(nID,lParam);
//Ifyouaddaminimizebuttontoyourdialog,youwillneedthecodebelow
//todrawtheicon.ForMFCapplicationsusingthedocument/viewmodel,
//thisisautomaticallydoneforyoubytheframework.
OnPaint()
if(IsIconic())
CPaintDCdc(this);
//devicecontextforpainting
SendMessage(WM_ICONERASEBKGND,(WPARAM)dc.GetSafeHdc(),0);
//Centericoninclientrectangle
intcxIcon=GetSystemMetrics(SM_CXICON);
intcyIcon=GetSystemMetrics(SM_CYICON);
CRectrect;
GetClientRect(&
rect);
intx=(rect.Width()-cxIcon+1)/2;
inty=(rect.Height()-cyIcon+1)/2;
//Drawtheicon
dc.DrawIcon(x,y,m_hIcon);
CPaintDCdc(this);
GetClientRect(rect);
dc.FillSolidRect(rect,RGB(222,247,252));
//设置背景颜色
OnPaint();
//Thesystemcallsthistoobtainthecursortodisplaywhiletheuserdrags
//theminimizedwindow.
HCURSORCRichengDlg:
OnQueryDragIcon()
return(HCURSOR)m_hIcon;
Ontianjia()//添加按钮功能实现
{
UpdateData(TRUE);
//数据导入
CStringdate,time;
GetDlgItem(IDC_DATETIMEPICKER1)->
GetWindowText(date);
//获取日期
GetDlgItem(IDC_DATETIMEPICKER2)->
GetWindowText(time);
//获取时间
m_listc.InsertItem(num,date+"
"
+time);
m_listc.SetItemText(num,1,m_event);
//日期时间事务在列表中显示
num++;
Addyourcontrolnotificationhandlercodehere
OnClickList1(NMHDR*pNMHDR,LRESULT*pResult)
LPNMITEMACTIVATEpNMItemActivate=reinterpret_cast<
LPNMITEMACTIVATE>
(pNMHDR);
if(pNMItemActivate->
iItem!
=-1)
choose=pNMItemActivate->
iItem;
*pResult=0;
OnNotify(WPARAMwParam,LPARAMlParam,LRESULT*pResult)
Addyourspecializedcodehereand/orcallthebaseclass
returnCDialog:
OnNotify(wParam,lParam,pResult);
OnNotifyIcon(WPARAMwParam,LPARAMIParam)
if(IParam==WM_LBUTTONUP)
{
//左键单击弹出主界面
ModifyStyleEx(0,WS_EX_TOPMOST);
ShowWindow(SW_SHOW);
elseif(IParam==WM_RBUTTONDOWN)
//右键单击弹出主菜单
toTray()
m_NotifyIcon.cbSize=sizeof(NOTIFYICONDATA);
m_NotifyIcon.hIcon=AfxGetApp()->
//装载程序图标
m_NotifyIcon.hWnd=m_hWnd;
lstrcpy(m_NotifyIcon.szTip,"
beskitv1.0"
//这里是鼠标移到托盘图标时的提示信息
m_NotifyIcon.uCallbackMessage=WM_NC;
m_NotifyIcon.uFlags=NIF_ICON|NIF_MESSAGE|NIF_TIP;
Shell_NotifyIcon(NIM_ADD,&
m_NotifyIcon);
//添加托盘图标
ShowWindow(SW_HIDE);
//隐藏主窗口
OnTimer(UINTnIDEvent)//响应定时器
Addyourmessagehandlercodehereand/orcalldefault
inti,j,k;
SYSTEMTIMEtime;
CStringtemp;
CStringtemp_1;
GetLocalTime(&
time);
temp.Format("
%d年%d月%d日%d:
%d:
%d"
time.wYear,time.wMonth,time.wDay,time.wHour,time.wMinute,time.wSecond);
k=0;
for(i=0;
i<
num;
i++)
CStringtemp_2;
temp_1=m_listc.GetItemText(i,0);
temp_2+=temp_1.GetAt(0);
for(j=1;
j<
temp_1.GetLength();
j++)
if(j<
temp_1.GetLength()-2)
{
if(temp_1.GetAt(j)=='
0'
&
(temp_1.GetAt(j+2)=='
'
||temp_1.GetAt(j-1)=='
))
j++;
}
else
if(temp_1.GetAt(j)=='
temp_1.GetAt(j-1)=='
)
charcheck[20];
if(j+k<
temp_1.GetLength()-4)
intk;
for(k=0;
k<
4;
k++)
check[k]=temp_1.GetAt(j+k);
check[k]='
\0'
;
if(strcmp(check,"
星期"
)==0)
j+=6;
//if(strcmp(check,"
)!
=0)
temp_2+=temp_1.GetAt(j);
if(temp_2==temp)
CStringa;
a=m_listc.GetItemText(i,1);
m_listc.DeleteItem(i);
num--;
PlaySound(MAKEINTRESOURCE(IDR_WAVE1),AfxGetResourceHandle(),SND_ASYNC|SND_RESOURCE|SND_NODEFAULT);
//设置提醒音乐
MessageBox(a);
//设置提醒窗口
OnTimer(nIDEvent);
OnRclickList1(NMHDR*pNMHDR,LRESULT*pResult)
LPNMITEMACTIVATEpNMItemActivate=reinterpret_cast<
CPointpt;
CMenumenu;
GetCursorPos(&
pt);
menu.CreatePopupMenu();
menu.AppendMenu(MF_STRING,IDS_menu,"
删除记录"
//删除记录
menu.TrackPopupMenu(TPM_LEFTALIGN,pt.x,pt.y,this);
menu.DestroyMenu();
Onmenu(UINT)
m_listc.DeleteItem(choose);
num--;
Onlink()
ShellExecute(NULL,NULL,_T("
),NULL,NULL,SW_SHOWNORMAL);
HBRUSHCRichengDlg:
OnCtlColor(CDC*pDC,CWnd*pWnd,UINTnCtlColor)
//颜色设定
HBRUSHhbr=CDialog:
OnCtlColor(pDC,pWnd,nCtlColor);
switch(nCtlColor)
caseCTLCOLOR_STATIC:
//静态文本
pDC->
SetBkMode(TRANSPARENT);
HBRUSHB=CreateSolidBrush(RGB(222,247,252));
//控件背景颜色
SetTextColor(RGB(51,51,255));
//控件中的文字颜色
return(HBRUSH)B;
}
caseCTLCOLOR_LISTBOX:
//列表框
HBRUSHB=CreateSolidBrush(RGB(234,234,234));
SetTextColor(RGB(255,0,0));
caseCTLCOLOR_DLG:
//对话框
HBRUSHB=CreateSolidBrush(RGB(222,247,252));
caseCTLCOLOR_EDIT:
//文本编辑框
HBRUSHB=CreateSolidBrush(RGB(255,255,255));
SetTextColor(RGB(8,8,8));
default:
}
returnhbr;
ChangeanyattributesoftheDChere
Returnadifferentbrushifthedefaultisnotdesired
3.用户操作方法
a.输入您要添加的事务;
b.输入事务提醒的时间;
c.点击添加按钮,即已添加事务;
d.左键点击需要删除的事务,右键进行删除操作;
e.点击最小化按钮则窗口最小盘到任务栏;
f.点击任务栏图标可查看已添加的事务也可再次添加事务;
4.输出结果
操作界面
提示窗口
六、上机心得体会
七、参考资料
1、谭浩强.C++面向对象程序设计题解与上机指导.北京:
清华大学出版社,2006,4.
2、候俊杰.深入浅出MFC.武汉:
华中科技大学出版社,2003,7.
3、VisualC++程序设计基础(第二版):
中国铁道出版社,2007.8
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 日程 备忘录 实习 报告