西华大学C++实验报告6对话框、按钮及编辑框控件

发布时间 : 星期三 文章西华大学C++实验报告6对话框、按钮及编辑框控件更新完毕开始阅读

西华大学实验报告 第 组 .

西华大学实验报告(计算机类)

开课学院及实验室:机械工程与自动化 实验时间 : 年 月 日

学 生 姓 名 学生所在学院 课 程 名 称 实验项目名称 指 导 教 师 学 号 成 绩 年级/专业/班 课 程 代 码 项 目 代 码 项 目 学 分 2011级机电 班 机械工程与自动化 高级语言在测控中的应用 简单的MFC应用程序设计 6003559 一、实验目的

1. 理解Windows编程特点;

2. 了解MFC应用程序的消息映射、数据映射机制; 3. 掌握用AppWizard(exe)创建SDI和MDI应用程序的方法; 4. 掌握使用项目工作区窗口的ClassView页面为类添加成员的方法; 5. 掌握用ClassWizard映射消息的方法。 6. 掌握对话框编辑器的使用方法;

7. 熟悉对话框的编程过程及控件的创建和使用方法; 8. 掌握静态控件、按钮和编辑框控件的使用方法。

二、内容与设计思想

上机实践内容:

1. 设计一个对话框,用于学生成绩的输入,要求能输入学生姓名、学号、性别以及3门课

程成绩,单击“求平均”按钮是计算3门课程的平均成绩并显示在上面的静态文本框中。通过单击“测试”菜单下的“成绩录入”子菜单调用该对话框,在该对话框中要用到控件:静态文本、编辑框(单行和多行)、单选框、复选框、组框、按钮等,其运行结果如下:

1

西华大学实验报告

算法设计思想与算法实现步骤等。

三、使用环境

操作系统:Windowns XP C++环境:Visual C++ 6.0

四、核心代码及调试过程

// ScoreInput.cpp : Defines the class behaviors for the application. //

//#include \#include \

2

西华大学实验报告

#include \#include \#include \

#ifdef _DEBUG

#define new DEBUG_NEW #undef THIS_FILE

static char THIS_FILE[] = __FILE__; #endif

///////////////////////////////////////////////////////////////////////////// // CScoreInputApp

BEGIN_MESSAGE_MAP(CScoreInputApp, CWinApp)

///////////////////////////////////////////////////////////////////////////// // CScoreInputApp construction

CScoreInputApp::CScoreInputApp() { }

// TODO: add construction code here,

// Place all significant initialization in InitInstance //{{AFX_MSG_MAP(CScoreInputApp) ON_COMMAND(ID_APP_ABOUT, OnAppAbout)

// NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code!

//}}AFX_MSG_MAP

// Standard file based document commands ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) // Standard print setup command

ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)

END_MESSAGE_MAP()

3

西华大学实验报告

///////////////////////////////////////////////////////////////////////////// // The one and only CScoreInputApp object

CScoreInputApp theApp;

///////////////////////////////////////////////////////////////////////////// // CScoreInputApp initialization

BOOL CScoreInputApp::InitInstance() {

#ifdef _AFXDLL

// Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. LoadStdProfileSettings(); // Load standard INI file options (including MRU) // Change the registry key under which our settings are stored. // TODO: You should modify this string to be something appropriate // such as the name of your company or organization.

SetRegistryKey(_T(\Enable3dControls();

// Call this when using MFC in a shared DLL // Call this when linking to MFC statically

#else

Enable3dControlsStatic(); #endif

// Standard initialization

// If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. AfxEnableControlContainer();

4

联系合同范文客服:xxxxx#qq.com(#替换为@)