




已阅读5页,还剩18页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
VC+ Course Design课程设计(论文)任务书 Software School College Software Engineer Major 20072 Class 一、Course Design(Paper)Title Calculator 二、Course Design(Paper)Start form 3rd Jan 2011 to 7th Jan 2011 三、Course Design(Paper) Address: Creative Building, Training Center of Software School 四、Course Design(Paper) Specifications:1The Aim of the Course DesignMaster VC interface design and consolidate C+ basic knowledge2The Requirements of the Course Design1)Basic Requirements: Using MFC editor and the C+ basic knowledge2)Other Requirements: To perform simple add,subtract,multiply and divide operation3)The Requirements of the Paper(1)The paper should includes: source code system study screen shot (2)Write and print the paper according to the format.4)Assessment Details: (1)Analysis:20 marks; (2)Design & Development:50 marks; (3)Test:10 marks;(4)Oral Examination:20 marks。5)References: 1.”Theach Yourself Visual C+ 6 in 21 Days”by Sams2.”C+ Study” by Tan Hao qiang 3.”VC+ MFC Extensions by Example”by John E.Swanke6)The Daily ScheduleTasks DaysAddressResearch and Analysis 1 LibraryDesign and Test 2.5 LabWrite Paper 1.5Library、Lab Student Signature: 7th Jan 2011课程设计(论文)评审意见(1)Analysis(20 marks):Excellent ( ) , Good ( ), Satisfactory ( ), Unsatisfactory ( ), Poor ( ); (2)Design & Development(20 marks):Excellent ( ) , Good ( ), Satisfactory ( ), Unsatisfactory ( ), Poor ( ); (3)Test(20 marks):Excellent ( ) , Good ( ), Satisfactory ( ), Unsatisfactory ( ), Poor ( ); (4)Translation(20 marks):Excellent ( ) , Good ( ), Satisfactory ( ), Unsatisfactory ( ), Poor ( ); (5)Oral Examination(20 marks):Excellent ( ) , Good ( ), Satisfactory ( ), Unsatisfactory ( ), Poor ( ); (6)Whether reduce to a lower rank because of the attendance or papers format :Yes ( ), No ( )Teacher Signature: th Jan 2011ContentContent- 3 -System Study- 4 -Screen shot- 5 -Source Code- 8 -References- 23 - System StudyThe “calculator” is a simple project in VC+. It used the basic controls like buttons.When you start the program, you can see nineteen buttons and textfile on the top of the window. There are different words on the buttons such as “o”.Once you clicked one button, a result would be show on the textfile. If you clicked the “1” button, 1 would appear,then you clicked the “+” button, then you clicked the “2”button,2would applear,then you click the “=”button,3 would applear,and so on. Finishing this project, we can learn how to build anapplication in VC+, how to use the basic controls and how to deal with the mouse events.Screen shot1. The main interface of the “On The Button With Drawing Shapes”2. Clicked the “39” button3. Clicked the “+” button4.Clicked the “29” button 5. Clicked the “=” buttonSource CodeAppendix 1: structural design source program list/file name:AdvButton.cpp/ / program function: to achieve high button control class./constructorCAdvButton:CAdvButton()/ / initialization m_ClientRectm_ClientRect.left = 0;m_ClientRect.top = 0;m_ClientRect.right = 0;m_ClientRect.bottom= 0;m_ClientRgn.DeleteObject(); m_ClientRgn.CreateEllipticRgnIndirect(&m_ClientRect); m_State = 0;m_Point.x = m_Point.y = 0;m_IsTimerOn = FALSE;BOOL CAdvButton:Create(LPCTSTR lpszCaption,DWORD dwStyle,const RECT& rect,CWnd *pParentWnd,UINT nID)return CButton:Create(lpszCaption, dwStyle, rect, pParentWnd, nID);void CAdvButton:OnLButtonUp(UINT nFlags, CPoint point) / TODO: Add your message handler code here and/or call defaultCRect rect;GetWindowRect(&rect); GetCursorPos(&m_Point); if(rect.PtInRect(m_Point)&(m_State != 1)m_State = 1;/1:focus stateInvalidate(); CButton:OnLButtonUp(nFlags, point);void CAdvButton:OnTimer(UINT nIDEvent) / TODO: Add your message handler code here and/or call defaultCRect rect;GetWindowRect(&rect); GetCursorPos(&m_Point); if(rect.PtInRect(m_Point) if(m_State != 1)&(m_State != 2)m_State = 1;Invalidate();else if(m_State != 0)m_State = 0;Invalidate(); KillTimer(nIDEvent); m_IsTimerOn = FALSE;CButton:OnTimer(nIDEvent);void CAdvButton:DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) /get client rectGetClientRect(&m_ClientRect); m_ClientRgn.DeleteObject();m_ClientRgn.CreateEllipticRgnIndirect(&m_ClientRect); SetWindowRgn(m_ClientRgn,FALSE); CDC* pDC = CDC:FromHandle(lpDrawItemStruct-hDC);CPen* pPen = NULL;switch (m_State) case 0:pPen = new CPen(PS_SOLID,1,DefaultColor);break;case 1:pPen = new CPen(PS_SOLID,1,FocusColor);break;case 2:pPen = new CPen(PS_SOLID,1,SelectColor);break;case 3:pPen = new CPen(PS_SOLID,1,DesiableColor);break;pDC-SetBkMode(TRANSPARENT);pPen = pDC-SelectObject(pPen);pDC-Ellipse(&m_ClientRect); pPen = pDC-SelectObject(pPen);if(pPen) delete pPen;LPTSTR pCaption = new charMAXCAPTIONLEN;/int iLen = GetWindowText(pCaption,MAXCAPTIONLEN);pDC-SetTextColor(TextColor); pDC-DrawText(pCaption,iLen,&m_ClientRect,DT_SINGLELINE|DT_CENTER|DT_VCENTER);Appendix 2: the object-oriented design source program list/ File name:CAdvEdit.cpp/ Program function:Realizing the advanced editing control class/ Draw edit control of the client areavoid CAdvEdit:OnDraw()CRect rect;GetClientRect(&rect);CDC* pDC = GetDC(); pDC-SetBkMode(TRANSPARENT); CBrush * pBrush = new CBrush(RGB(255,255,255); pDC-FillRect(&rect,pBrush); pDC-SetTextColor(RGB(92,92,92);pDC-DrawText(m_Caption,rect,DT_SINGLELINE|DT_VCENTER|DT_RIGHT);Appendix 3: object-oriented design source program list/ File name:CalculatorDlg.cpp/ Program function: realize dialog interface design and calculator numerical computation function/ Initialize dialog functionsBOOL CCalculatorDlg:OnInitDialog()CDialog:OnInitDialog(); m_Menu = new CMenu; /m_Menu-LoadMenu(IDR_MENU); SetMenu(m_Menu); return TRUE; /return TRUE unless you set the focus to a controlvoid CCalculatorDlg:OnExtend()CRect rect;GetWindowRect(&rect);if(m_IsExtend) GetWindowRect(&rect); SetWindowPos(&wndTop,0,0,186,rect.Height(),SWP_NOMOVE|SWP_NOZORDER);m_DspEdit.GetWindowRect(&rect);m_DspEdit.SetWindowPos(NULL,rect.left,rect.top,155,rect.Height(),SWP_NOMOVE|SWP_NOZORDER);m_DspStatic.GetWindowRect(&rect);m_DspStatic.SetWindowPos(NULL,rect.left,rect.top,168,rect.Height(),SWP_NOMOVE|SWP_NOZORDER);m_Menu-ModifyMenu(ID_EXTEND,MF_BYCOMMAND|MF_STRING,ID_EXTEND, expansion );m_IsExtend = FALSE;elseSetWindowPos(&wndTop,0,0,330,rect.Height(),SWP_NOMOVE|SWP_NOZORDER); m_DspEdit.GetWindowRect(&rect);m_DspEdit.SetWindowPos(NULL,rect.left,rect.top,155,rect.Height(),SWP_NOMOVE|SWP_NOZORDER); m_DspStatic.GetWindowRect(&rect);m_DspStatic.SetWindowPos(NULL,rect.left,rect.top,168,rect.Height(),SWP_NOMOVE|SWP_NOZORDER);m_Menu-ModifyMenu(ID_EXTEND,MF_BYCOMMAND|MF_STRING,ID_EXTEND, standard );m_IsExtend = TRUE;void CCalculatorDlg:OnRad() m_isDegree=1;DtoR=1;UpdateData(TRUE);void CCalculatorDlg:OnDegree() m_isDegree=0;DtoR=(2*PI)/360;UpdateData(FALSE);void CCalculatorDlg:AdvButton1(m_StrBegin = m_StrBegin+1;if (!m_IsCheckPoint) m_DspEdit.OnDisplay(m_StrBegin+.);else m_DspEdit.OnDisplay(m_StrBegin);void CCalculatorDlg:AdvButton2()m_StrBegin = m_StrBegin+2;if (!m_IsCheckPoint) m_DspEdit.OnDisplay(m_StrBegin+.);else m_DspEdit.OnDisplay(m_StrBegin);void CCalculatorDlg:AdvButton3()m_StrBegin = m_StrBegin+3;if (!m_IsCheckPoint) m_DspEdit.OnDisplay(m_StrBegin+.);else m_DspEdit.OnDisplay(m_StrBegin);void CCalculatorDlg:AdvButton4()m_StrBegin = m_StrBegin+4;if (!m_IsCheckPoint) m_DspEdit.OnDisplay(m_StrBegin+.);else m_DspEdit.OnDisplay(m_StrBegin);void CCalculatorDlg:AdvButton5()m_StrBegin = m_StrBegin+5;if (!m_IsCheckPoint) m_DspEdit.OnDisplay(m_StrBegin+.);else m_DspEdit.OnDisplay(m_StrBegin);void CCalculatorDlg:AdvButton6()m_StrBegin = m_StrBegin+6;if (!m_IsCheckPoint) m_DspEdit.OnDisplay(m_StrBegin+.);else m_DspEdit.OnDisplay(m_StrBegin);void CCalculatorDlg:AdvButton7()m_StrBegin = m_StrBegin+7;if (!m_IsCheckPoint) m_DspEdit.OnDisplay(m_StrBegin+.);else m_DspEdit.OnDisplay(m_StrBegin);void CCalculatorDlg:AdvButton8()m_StrBegin = m_StrBegin+8;if (!m_IsCheckPoint) m_DspEdit.OnDisplay(m_StrBegin+.);else m_DspEdit.OnDisplay(m_StrBegin);void CCalculatorDlg:AdvButton9()m_StrBegin = m_StrBegin+9;if (!m_IsCheckPoint) m_DspEdit.OnDisplay(m_StrBegin+.);else m_DspEdit.OnDisplay(m_StrBegin);void CCalculatorDlg:Result() m_IsCheckPoint = false; m_begin = atof(m_StrBegin); switch(m_bit)case 1:m_end += m_begin;break;case 2:m_end -= m_begin;break;case 3:m_end *= m_begin;break;case 4:if (m_begin=0)m_DspEdit.OnDisplay(Divisor cannot be zero!);return;m_end /= m_begin;break;case 5:if (m_end0)m_DspEdit.OnDisplay(Function input invalid!);return;m_end = sqrt(m_end);break;case 6:m_end = 1/m_end;case 7:break;case 8:m_end = sin(m_end*DtoR);break;case 9:m_end = cos(m_end*DtoR);break;case 10:m_end = tan(m_end*DtoR);break;case 11:m_end = m_end*m_end;break;case 12:m_end = m_end*m_end*m_end;break;case 13:m_end = pow(m_end,m_begin);break;case 14:m_end = exp(m_end);break;case 15:if (m_end=0)m_DspEdit.OnDisplay(Function input invalid!);return;m_end = log(m_end);br
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025-2030中国基因治疗药物研发进展与临床试验趋势报告
- 2025-2030中国动力电池回收利用体系建设与循环经济价值分析报告
- 2025-2030中国共享居住社区运营效率与盈利模式探讨
- 2025-2030中国公寓装修标准化体系与成本控制方案报告
- 2025-2030中国元宇宙数字内容创作工具开发生态构建路径分析报告
- 2025-2030中国AI绘画工具版权争议与内容审核机制
- 2025-2030mRNA肿瘤疫苗个体化治疗成本控制方案报告
- 物业服务合同范本及争议解决方法
- 2025防疫人员试题及答案解析
- 深值医疗影像诊断-洞察及研究
- 酒店前台新员工培训
- 抽水蓄能电站项项目立项报告
- 餐饮行业部SOP运营管理手册
- 健康跑活动安全免责协议书
- DB11∕T 2000-2022 建筑工程消防施工质量验收规范
- 护理学科建设
- 1《中国人民站起来了》课堂实录2024-2025学年高中语文选择性必修上册
- 3银行出纳3支票
- 第二单元(教学课件)-【大单元教学】三年级语文上册同步备课系列(统编版)
- 中国盐业集团有限公司招聘笔试题库2024
- 人教版培智一年级(上)生活语文教案
评论
0/150
提交评论