您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > 桌面万年历程序设计综合实践报告
程序设计综合实践报告(C语言)项目名称:桌面万年历班级:姓名:学号:山东科技大学信息科学与工程学院2012年12月2目录1.项目概述··············································································31.1需求陈述········································································31.2开发技术、环境与工具······················································32.软件需求··············································································32.1功能性需求·····································································32.2非功能性需求··································································33.软件架构设计········································································34.软件详细设计与实现·······························································34.1主要模块的流程图····························································34.2核心代码········································································45总结与体会·········································································225.1遇到的问题与解决途径·····················································225.2心得体会······································································2231.项目概述1.1需求陈述本项目是桌面小时钟的实现,表盘上可以实现星期、年月日、时分秒、生肖以及天干地支,右击可以打开延伸项目,包括日历、关于、表盘颜色设置、以及退出等选型,在日历表中可以实现从1901-2099年公历农历以及周几的查询,在日历表格中也可以进行换肤操作,同时还可以进行闹钟设定,通过“开启闹钟”“关闭闹钟”两个按钮来实现对闹钟开关的控制1.2开发技术、环境与工具相关技术:1、(DrawClocktext)2、(DrawCalendar)2.软件需求基于c语言利用vb2008实现改程序2.1功能性需求可以实现时钟的消息处理(包括添加图片、背景色透明、更新时钟、绘制时钟、弹出菜单、处理菜单消息)、绘制时钟(包括年月日、时分秒)、万年历的背景的绘制、日历的绘制、以及按键消息。2.2非功能性需求编制闹钟,实现了闹钟的设定3.软件架构设计1、日历绘制函数2、表盘函数的绘制3、按键函数的绘制4.软件详细设计与实现1、通过GetLocalTime(&datetime);来实现获得当下时间,然后通过SunToLunar实现公历和农历日期的转化。通过绘制表格,由GetDayOfWeek可以判断出某一天是周几,然后可以确定日历表中各个月份天数所在的位置,实现了万年历的基本功能。其次,利用按键功能,实现了对年月日的的选择。利用playsound实现对音频的输出。4.1主要模块的流程图4.1系统模块划分系统主要是由头文件和源文件,主要功能是在源文件内实现4.2主要功能模块系统的主要功能都在Main.c实现的。主要包含以下函数44.2.1voidCalendarButtonEvent(UINTnID)实现了日历上的月份、闹钟按钮的调试4.2.2voidDrawCalendar(HDChDC,intnWidth,intnHeight)实现了日历的绘制,包括表格的绘制,星期,年月日,农历月份,生效图片及文字的输出4.2.3voidDrawClockText(HDChDC)实现了表盘上的时间年月日天干地支星期的输出4.2.4其他要用的函数GetDayOfWeek确定某一天是周几GetGanZhi确定了某一年是所对应的干支年份IsLeapYear判断某一年是否为闰年SunToLunar实现了由公历日期得到农历日期WinMain实现了惨淡信息的输出4.3核心代码#includepublic.h#includeWindows.h#includestdio.h#includemmsystem.h#includestring.h#includeresource.h//#pragmacomment(lib,CalenderApp.lib)//#pragmacomment(lib,WINMM.LIB)//导入声音用voidSetDlgMenuID(UINTnMainDlgID,UINTnCalendarDlgID,UINTnMenuID);voidSetButtonID(UINTnCalendarID,UINTnExitID,UINTnBiaoPan1,UINTnBiaoPan2,UINTnBiaoPan3);INT_PTRShowMainDlg();//用来计算日期/**********************************************************API函数参考:GetLocalTime:获得当前时间(公历:年、月、日、周)MoveToEx:移动划线的起点LineTo:绘制到某一点SetTextColor:设置要绘制的文字颜色TextOut:绘制文字GetLocalTime:获得当前系统的本地时间结构体类型参考:SYSTEMTIME:描述时间类型,包括年月日、时分秒、周**********************************************************/HINSTANCEg_hInst;//保存操作系统传递进来的应用程序实例句柄5typedefstruct_stDateTime{intnYear;intnMonth;intnDay;}stDateTime;//定义表格,存储年-2099年的农历信息:每年的大小月、闰月信息、春节所在的公历日期unsignedintLunarCalendarTable[199]={0x04AE53,0x0A5748,0x5526BD,0x0D2650,0x0D9544,0x46AAB9,0x056A4D,0x09AD42,0x24AEB6,0x04AE4A,/*1901-1910*/0x6A4DBE,0x0A4D52,0x0D2546,0x5D52BA,0x0B544E,0x0D6A43,0x296D37,0x095B4B,0x749BC1,0x049754,/*1911-1920*/0x0A4B48,0x5B25BC,0x06A550,0x06D445,0x4ADAB8,0x02B64D,0x095742,0x2497B7,0x04974A,0x664B3E,/*1921-1930*/0x0D4A51,0x0EA546,0x56D4BA,0x05AD4E,0x02B644,0x393738,0x092E4B,0x7C96BF,0x0C9553,0x0D4A48,/*1931-1940*/0x6DA53B,0x0B554F,0x056A45,0x4AADB9,0x025D4D,0x092D42,0x2C95B6,0x0A954A,0x7B4ABD,0x06CA51,/*1941-1950*/0x0B5546,0x555ABB,0x04DA4E,0x0A5B43,0x352BB8,0x052B4C,0x8A953F,0x0E9552,0x06AA48,0x6AD53C,/*1951-1960*/0x0AB54F,0x04B645,0x4A5739,0x0A574D,0x052642,0x3E9335,0x0D9549,0x75AABE,0x056A51,0x096D46,/*1961-1970*/0x54AEBB,0x04AD4F,0x0A4D43,0x4D26B7,0x0D254B,0x8D52BF,0x0B5452,0x0B6A47,0x696D3C,0x095B50,/*1971-1980*/0x049B45,0x4A4BB9,0x0A4B4D,0xAB25C2,0x06A554,0x06D449,0x6ADA3D,0x0AB651,0x093746,0x5497BB,/*1981-1990*/0x04974F,0x064B44,0x36A537,0x0EA54A,0x86B2BF,0x05AC53,0x0AB647,0x5936BC,0x092E50,0x0C9645,/*1991-2000*/0x4D4AB8,0x0D4A4C,0x0DA541,0x25AAB6,0x056A49,0x7AADBD,0x025D52,0x092D47,0x5C95BA,0x0A954E,/*2001-2010*/0x0B4A43,0x4B5537,0x0AD54A,0x955ABF,0x04BA53,0x0A5B48,0x652BBC,0x052B50,0x0A9345,0x474AB9,/*2011-2020*/0x06AA4C,0x0AD541,0x24DAB6,0x04B64A,0x69573D,0x0A4E51,0x0D2646,0x5E933A,0x0D534D,0x05AA43,/*2021-2030*/0x36B537,0x096D4B,0xB4AEBF,0x04AD53,0x0A4D48,0x6D25BC,0x0D254F,0x0D5244,0x5DAA38,0x0B5A4C,/*2031-2040*/0x056D41,0x24ADB6,0x049B4A,0x7A4BBE,0x0A4B51,0x0AA546,0x5B52BA,0x06D24E,0x0ADA42,0x355B37,/*2041-2050*/0x09374B,0x8497C1,0x049753,0x064B48,0x66A53C,0x0EA54F,0x06B244,0x4AB638,0x0AAE4C,0x092E42,/*2051-2060*/0x3C9735,0x0C9649,0x7D4ABD,0x0D4A51,0x0DA545,0x55AABA,0x056A4E,0x0A6D43,0x452EB7,0x052D4B,/*2061-2070*/0x8A95BF,0x0A9553,0x0B4A47,0x6B553B,0x0AD54F,0x055A45,0x4A5D38,0x0A5B4C,0x052B42,0x3A93B6,/*2071-2080*/0x069349,0x7729BD,0x06AA51,0x0AD546,0x54DABA,0x04B64E,0x0A5743,0x452738,0x0D264A,0x8E933E,/*2081-2090*/0x0D5252,0x0DAA47,0x66B53B,0x056D4F,0x04AE45,0x4A4EB9,0x0A4D4C,0x0D1541,0x2D92B5/*2091-2099*/};char*TianGanDizhi[60]={甲子,乙丑,丙寅,丁卯,戊辰,已巳,庚午,辛未,壬申,癸酉,甲戌,乙亥,丙子,丁丑,
本文标题:桌面万年历程序设计综合实践报告
链接地址:https://www.777doc.com/doc-4458739 .html