VS2005教程

上传人:gbs****77 文档编号:9875055 上传时间:2020-04-08 格式:DOC 页数:150 大小:6.20MB
返回 下载 相关 举报
VS2005教程_第1页
第1页 / 共150页
VS2005教程_第2页
第2页 / 共150页
VS2005教程_第3页
第3页 / 共150页
点击查看更多>>
资源描述
Visual C 2005 教程 目 录 第一章 Windows 程序开发简介 2 DOS 中用户使用软件的方式 2 Windows 中用户使用软件的方式 3 Windows 中程序运行的机制 4 第二章 Windows 编程初步 6 第一个程序 6 查看系统库函数的帮助说明 19 设置控件的属性 20 完成的程序 24 输入数据的控件 26 第三章 Windows 编程进阶 33 列表框控件 34 单选框控件 36 组合框控件 37 复选框控件 40 列表框控件 44 图片控件 48 更多的功能 49 完整的示例代码 50 第四章 Windows 图形编程 61 创建菜单 61 创建工具条 67 绘制图形 74 第五章 数据库编程 80 数据库简介 80 数据库的建立 80 ODBC 数据源的设置方法 86 数据库的访问方法 91 一个实际的例子 95 第六章 线程机制 114 线程的概念 114 线程的状态 114 线程的优先级 115 线程的创建和管理 116 一个演示示例 117 前台线程和后台线程 119 线程优先级 120 挂起线程和恢复线程 121 终止线程 121 时钟线程 122 第七章 网络编程 123 TCP IP 协议原理介绍 123 Internet 概述 123 TCP IP 协议 124 网络应用程序的运行模式 127 NetFrameWork 中的 Socket 类库 128 访问网页 132 一个聊天程序 132 第一章 Windows 程序开发简介 开发运行在 Windows 操作系统中的软件需要掌握关于 Windows 系统下编程的技术 现在 业界有多种成熟的 Windows 开发技术 在本书中 将介绍使用 Net Framework 来开发 Windows 软件 那什么是 Net Framework 呢 简单的说 Net Framework 就是一个 C 的类 库 专门用来简化 Windows 程序设计的 大家以前学习的 C 是 DOS 下的编程模式 编 写出来的程序只能在 DOS 下面运行 但是现在随着 Windows 的流行 仅仅编写 DOS 的应 用程序已经不能满足当前计算机用户的需要了 所以从现在开始要学习如何编写 Windows 的应用程序 由于 DOS 和 Windows 两种操作系统运作方式的巨大差异 导致了写 DOS 程序和写 Windows 程序在程序的写法上有很大的不同 下面先讲述一下在 DOS 和 Windows 两种操作系统下用户是如何使用软件的 1 DOS 中用户使用软件的方式 假设用户现在在运行一个记账的软件 这个软件有两个版本 DOS 版本和 Windows 版本 在 DOS 中 DOS 版本的软件会在屏幕上显示如下的菜单 请选择下列操作 1 创建一个账号 2 删除一个账号 3 修改一个账号 4 录入数据 5 退出 然后用户用键盘输入命令代号 软件根据命令代号执行相应的功能 2 Windows 中用户使用软件的方式 而在 Windows 中 所有的应用程序都不再使用这种文本方式的界面了 取而代之的是窗口 化的界面 如下图所示 这种窗口化的界面尽管也有菜单 但是其操作方式和工作原理和 DOS 中的完全不同 在 DOS 中 用户一般使用键盘输入命令和数据 程序使用 cin 或者 scanf 函数来获取用户的 输入命令 而在 Windows 中 用户既可以使用键盘来操作 也可以使用鼠标来操作 而且 鼠标既可以点击菜单 也可以点击工具栏 所以在 Windows 程序中 仅仅使用 cin 函数来 获得用户的输入命令和数据已经远远不够了 因此为了开发 Windows 程序 Windows 提供 了一套全新的函数供软件设计者获得用户的输入 除此之外 为了要在屏幕上面显示出窗口 还要在窗口中显示不同字体 颜色的文字 甚 至还有图形和动画 Windows 还提供了其它一些相应的函数来完成这些功能 所有的这些 函数被微软公司统称为 Windows API 函数 或者是 Win32 API 函数 因为现在的 Windows 操作系统一般是 32 位的操作系统 3 Windows 中程序运行的机制 下面讲述一下在 Windows 中程序是如何运行的 在 Windows 中 用户既可以使用键盘来 操作 也可以使用鼠标来操作 而且鼠标既可以点击菜单 也可以点击工具栏 为了使处 理方式简单化 在 Windows 中 程序使用了一种称为消息的模式来获取用户的输入 一个 消息由一组 4 个数据组成 分别是消息的类型 接受消息的窗口 消息中包含的数据 两 个 32 位的整型数 分别命名为 wParam 和 lParam 比如说用户选择了某个菜单项 Windows 系统就向相应的窗口发送如下的消息 消息类型 WM COMMAND 表示是一个命令消息 接受消息的窗口 A wParam 菜单项的代号 lParam 空 一般在 Windows 程序中都会设置一个无限循环来获取消息并根据所获取的消息调用相应的 消息处理函数 如下所示 Main message loop while GetMessage DispatchMessage GetMessage 函数获取当前发送给该窗口的消息 TranslateMessage 函数把消息翻译一下 然后由 DispatchMessage 函数调用相应的消息处理函数来执行对应的功能 在 Windows 中界面是由窗口构成的 那么程序如何 创建窗口呢 这需要用到一个叫做 CreateWindow 的函数 这个函数负责创建一个窗口 并设定窗口的大小 位置 标题文 字 风格 窗口的消息处理函数等等 在创建好了窗口之后 程序还要负责在窗口中显示内容 否则的话窗口就像是透明的 可 以看到窗口后面的东西 这项工作也是在一个消息处理函数中完成的 但为什么是在一个 消息处理函数中完成而不是调用一个普通的绘图函数 这是因为 Windows 的显示方式和 DOS 不一样 在 DOS 中 由于一次只能运行一个程序 所以一个程序显示的文字不会被 别的程序抹掉 而在 Windows 中 由于可以有多个程序同时运行 因此如果 A 程序在窗 口中显示了内容后就不去管它的话 一旦用户切换到别的程序 而那个程序的窗口和 A 程 序的窗口又有重叠时 那个程序就会把 A 程序窗口中的内容给覆盖掉 代之以它的内容 那么等到用户使用完那个程序后回到 A 程序 A 程序窗口中的内容就将是那个程序的内容 了 为了避免这种情况的发生 在 Windows 中一个窗口什么时候应该显示内容是由 Windows 系统本身来控制的 如果 Windows 系统发现一个窗口被激活了 需要更新它窗口中的内容 它就会发送一条名为 WM PAINT 的消息给那个窗口 通知它 你要更新一下你窗口里面 的内容了 所以在 Windows 程序中 几乎所有的显示工作都是在 WM PAINT 的消息 处理函数中完成的 由于 Windows 程序运作机制的复杂性 如果仅仅使用 Windows API 函数来写 Windows 程 序的话 一般一个最小的 Windows 程序也需要一百多行的代码 这和 DOS 下的程序往往 寥寥数行就可以解决问题形成了鲜明的对比 为了解决 Windows 程序开发繁琐的问题 微 软推出了一套名为 Net Framework 简写为 Net 的 C 类库 旨在简化 Windows 软件的开 发 在这套类库中 几乎所有常用的 Windows API 函数都被封装在相应的类里面 而且 Net Framework 还提供了一套现成的程序模版 通过对模版程序的简单修改 程序员就能 够很快的编写出一个标准的 Windows 程序 第二章 Windows 编程初步 下面几章的重点就将讲述如何使用 Net Framework 来开发 Windows 程序 首先先介绍一下 开发用的软件 Visual Studio 2005 这是微软公司推出的一套专门用于开发 Windows 程 序的开发环境 在这个环境中 可以完成各种 Windows 软件的开发 1 第一个程序 启动 Visual Studio 2005 后可以看到类似下面的界面 在 Visuall Studio 2005 里面写程序 哪怕是很小一个程序都需要建立一个项目 项目实际上 就是一堆文件的集合 因为在编写大型软件时往往一个软件会由几千个源文件组成 为了 保证可以轻松的找到需要的文件 Visuall Studio 2005 中采用 项目 和 解决方案 这两 个概念来管理所有这些文件 解决方案 包括所有的文件 可以包含多个 项目 每一 个项目是一个独立的程序 也可以是一个供其它项目使用的公共库 下面给出建立一个项目的具体步骤 选菜单 文件 新建 项目 如下图所示 项目的名称设为 DemoOne 类型为 CLR 控制台应用程序 解决方案的名称设为 Demo 如下图所示 点击 确定 按钮后一个新的解决方案和项目就建立好了 如下图所示 现在在源代码窗口中输入如下的代码 include stdafx h using namespace System int main array args Console WriteLine L Hello World n Console WriteLine L Press Enter key to quit Console ReadLine return 0 这是一个传统的命令行程序 现在来执行这个程序 点击如下图所示的菜单就可以运行程 序了 如果是第一次运行 Visuall Studio 2005 可能会出现如下的提示 这时点击 是 就可以了 程序的运行结果如下 按下回车键结束程序 第一个小程序就写好了 但是这是一个传统的命令行程序 体现不出 Windows 编程的特点 所以下面再来写一个真正具有 Windows 风格的程序 刚才已经建立了一个 解决方案 和一个 项目 现在在这个 解决方案 中再添加一个 项目 在 解决方案 名字上点击鼠标右键 选择 新建项目 如下图所示 这时会出现一个对话框 让用户选择项目的类型 现在要写的是一个 Windows 程序 所以 选择 Windows 窗体应用程序 然后在 名称 一栏里面填入项目的名字 在这里叫它 Hello 如下图所示 项目建立好了就会出现如下图所示的界面 一个空白的窗体 在上图中可以看到 现在有两个项目在解决方案 Demo 里面 一个叫 DemoOne 一 个叫 Hello 这两个程序互相不会影响 注意到其中 DemoOne 的字样是粗体 这表 示 DemoOne 这个项目是启动项目 这就是说 用户点击 启动调试 菜单运行程序时 DemoOne 这个程序将被运行 但是现在需要调试的是 Hello 这个程序 所以需要把 Hello 设为启动项目 这只需在 Hello 上面点击鼠标右键 选 设为启动项目 就可 以了 如下图所示 现在这个空白的窗体程序什么事情都干不了 但是这个程序是个很好的起点 用户可以在 它的基础上添加各种其它的功能 下面给它添加一个按钮 首先将鼠标箭头移到屏幕右侧的 工具箱 标签上面 这是屏幕右边会弹出一个 工具箱 窗口 里面列出了各种各样的窗口控件 如下图所示 这时用鼠标左键点一下 Button 工具 如下图所示 然后在 Form1 窗体上面拉出一个按钮 如下图所示 系统会自动的给这个按钮起个名 字叫 Button1 按钮是做好了 但是这时的按钮还只是个摆设 没有实际的功能 也就是说 当运行程序 按下这个按钮的时候 什么事情都不会发生 这是因为程序中所有的功能都必须由相应的 代码来实现 而现在并没有为按下按钮这个操作编写代码 所以当然按钮被按下时就什么 也不会发生了 现在来为 按下按钮 这个操作写一些代码 用鼠标左键双击屏幕上面的 Button1 按钮 此时 Visuall Studio 2005 会自动的将屏幕切换到代码窗口 并给 Button1 按钮添加一个按钮被按下时的响应函数 如下图所示 这个函数名字叫 button1 Click 其中 button1 是按钮的名字 Click 表示这个函数将在按 钮被点中时执行 现在来给它添加一个功能 让按钮在被按下时弹出一个消息框 上面写 着 Welcome to use Visual C 2005 为了完成这个功能 需要调用系统的一个函数 MessageBox Show 这个函数的功能就是弹出一个消息框 具体的代码如下 private System Void button1 Click System Object sender System EventArgs e MessageBox Show Hello Welcome To Use Visual C 2005 代码写好后就可以运行这个程序来看看效果了 同样选菜单 调试 启动调试 或者直接 按下快捷键 F5 就可以运行程序了 如下图所示 还可以按下下图中所示的 启动调试 按钮 也可以运行程序 这是一个快捷按钮 程序运行成功 如下图所示 现在来点击一下窗口中的 button1 按钮 看看是不是有如下图所示的消息框弹出来 2 查看系统库函数的帮助说明 在开发 Windows 软件的过程中需要调用大量的系统库函数 如果在写程序的时候看到一个 库函数不知道它的用法 可以把光标移动到这个函数上面 然后按下 F1 键 就可以看 到关于这个函数的帮助说明了 第一次使用这个功能的时候系统可能会显示如下图所示的 提示 这时可以选择 使用本地帮助做为主要源 以系统库函数 Console WriteLine 为例 可以看到如下图所示的帮助说明 3 设置控件的属性 现在程序运行后窗口的标题还是 Form1 这个是系统自动给起的名字 新的程序需要以 自己的名字命名 那么怎么给窗口改名字 标题 呢 很简单 只要在窗体上按下鼠标右 键 就会弹出一个菜单 如下图所示 点击 属性 这是屏幕右边就会弹出一个琳琅满目的属性设置框 里面显示了这个窗口的 各种可以修改的属性 或者叫参数 如下图所示 修改其中的 Text 属性 如上图所示 把它改成 第一个程序 改完后会发现窗口的标 题立即就换成了 第一个程序 如下图所示 第一步修改完成了 现在进一步把那个叫 button1 的按钮的名字也改掉 毕竟一个按钮 叫 button1 用户会不知道这是什么意思 用鼠标左键点中按钮 button1 在右侧的属性设置框中修改 Text 属性 如下图所示 把它改成 执行 改好后按钮上面的字会立即变成 执行 如下图所示 现在再来运行一下这个程序 看看界面是不是改过来了 如下图所示 4 完成的程序 下面把完整的源代码列在这里 以供参考 pragma once namespace Hello using namespace System using namespace System ComponentModel using namespace System Collections using namespace System Windows Forms using namespace System Data using namespace System Drawing Form1 摘要 警告 如果更改此类的名称 则需要更改 与此类所依赖的所有 resx 文件关联的托管资源编译器工具的 资源文件名 属性 否则 设计器将不能与此窗体的关联 本地化资源正确交互 public ref class Form1 public System Windows Forms Form public Form1 void InitializeComponent TODO 在此处添加构造函数代码 protected 清理所有正在使用的资源 Form1 if components delete components private System Windows Forms Button button1 protected private 必需的设计器变量 System ComponentModel Container components pragma region Windows Form Designer generated code 设计器支持所需的方法 不要 使用代码编辑器修改此方法的内容 void InitializeComponent void this button1 gcnew System Windows Forms Button this SuspendLayout button1 this button1 Location System Drawing Point 73 70 this button1 Name L button1 this button1 Size System Drawing Size 133 75 this button1 TabIndex 0 this button1 Text L 执行 this button1 UseVisualStyleBackColor true this button1 Click gcnew System EventHandler this Form1 this AutoScaleDimensions System Drawing SizeF 6 13 this AutoScaleMode System Windows Forms AutoScaleMode Font this ClientSize System Drawing Size 292 271 this Controls Add this button1 this Name L Form1 this Text L 第一个程序 this ResumeLayout false pragma endregion private System Void button1 Click System Object sender System EventArgs e MessageBox Show Hello Welcome To Use Visual C 2005 5 输入数据的控件 一般Windows里面的应用程序都需要用户输入数据的 这个程序也不例外 下面就来给它 添加输入数据的功能 首先把执行按钮缩小并移动到窗口下面 然后在右侧的工具箱中选取 TextBox 工具 如 下图所示 在窗口中拉出一个输入框 如下图所示 在右侧的属性修改框中将它的名字改成 InputLine 如下图所示 这是将会发现代码中多了一行关于这个输入框的声明 如下图所示 然后在函数 button1 click 中添加如下的代码 private System Void button1 Click System Object sender System EventArgs e String line 你输入的是 InputLine Text MessageBox Show line 按下 F5 键执行程序 在输入框中输入 aaa 如下图所示 然后点击 执行 按钮 就会弹出如下图所示的消息框 现在屏幕上的输入框没有任何提示 用户使用这个程序会不知道要输入什么东西 下面来 给它加个提示 在右侧的工具箱里选 Label 工具 如下图所示 在窗体中拉出一个提示标签 如下图所示 点中这个标签 在右侧的属性修改框中把 Text 一栏改为 请输入一些文字 如下图所 示 运行程序就会发现现在输入框有了提示文字 如下图所示 第三章 Windows 编程进阶 公司人事档案管理软件 下面来学习设计一个公司人事档案管理软件 通过学习设计这个软件 将会学到很多新的 控件的使用方法 新建一个项目 HRManagement 如下图所示 把 Form 的尺寸拉大一些 因为将要在里面加入很多控件 如下图所示 1 列表框控件 首先给 Form 添加一个 员工列表 列表框 点击 工具箱 里面的 ListBox 控件 如 下图所示 在 Form 里面拉出一个列表框 并将其命名为 EmployeeList 如下图所示 然后在 Form 里面加入一个 姓名 输入框 将其命名为 EmployeeName 如下图所示 2 单选框控件 如上图所示在 工具箱 里面选中 GroupBox 控件 在 Form 里面拉出一个 性别 框 然后在 工具箱 里面选中 Radiobutton 控件 在 性别 框里面拉出一个 男 一个 女 两个 Radio 按钮 分别命名为 GenderMale GenderFemale 如下图所示 3 组合框控件 如下图所示在 工具箱 里面选中 ComboBox 控件 在 Form 里面拉出一个 部门 选 择框 命名为 Department 在这个 部门 选择框中用户可以选择这名员工是属于哪个部门的 这就需要预先设置好 各个部门的名称 这些数据将在 部门 选择框的属性中输入 点击 部门 选择框 在右侧的属性修改框中找到名为 Items 的一栏 如下图所示 点击右侧的 将会弹出一个输入框 让你输入选择框里面将要显示的内容 比如说公 司各个部门的名称 现在输入如下图所示的部门名称 再给程序添加一个 电话 输入框 命名为 Phone 如下图所示 为了把 部门 和 电话 两个控件对齐排列 可以同时选择这两个控件 然后点击上图 所示的 对齐 按钮就可以了 4 复选框控件 选中工具箱里面的 CheckBox 在 Form 里面添加一个 实习生 选框 命名为 IsIntern 如下图所示 再在 Form 里面添加一个 添加 按钮 命名为 AddButton 如下图所示 现在软件已经做了一半了 再给它添加一些代码 让它可以实际运行起来 首先先新建一个文件叫 Tools h 输入下面的代码 Header file for Tools namespace HRManagement using namespace System public ref class EmployeeRecord public String m Name String m Gender String m Department String m Phone String m IsIntern String m Photo EmployeeRecord 然后在 Form1 h 文件里面找到如下的这行代码 public ref class Form1 public System Windows Forms Form 在这个类里面添加如下的代码 public ref class Form1 public System Windows Forms Form public array g EmployeeList public int g EmployeeCount public Form1 void InitializeComponent g EmployeeList gcnew array 100 g EmployeeCount 0 GenderMale Checked true 然后为 添加 按钮添加一个响应函数 就像上面那个例子里面做的一样 具体的代码如 下 private System Void AddButton Click System Object sender System EventArgs e EmployeeRecord r gcnew EmployeeRecord r m Name EmployeeName Text r m Department Department Text if GenderMale Checked r m Gender 男 else r m Gender 女 r m Phone Phone Text if IsIntern Checked r m IsIntern 是 else r m IsIntern 否 g EmployeeList g EmployeeCount r EmployeeList Items Add r m Name 现在这个程序就可以运行了 大家可以试试看 看能不能添加一个员工记录 5 列表框控件 下面再给程序添加一些新的功能 首先要给它添加一个列表框 这样员工的档案情况就可 以看得一目了然了 选中右侧工具箱里面的 ListView 工具 在窗体里面拉出一个列表框 命名为 EmployeeListView 如下图所示 然后选中它 在右侧的属性修改框里面点击 Column 右侧的 按钮 我们将要给这个列 表框添加各种表头 如下图所示 现在弹出的对话框就是用来编辑列表头的 如下图所示添加五个表头 下面就是程序运行时的样子 再给它添加一个 删除 按钮 命名为 DeleteButton 如下图所示 给这个按钮添加一个事件处理函数 具体代码如下 private System Void DeleteButton Click System Object sender System EventArgs e 获取用户选择的员工名字在列表中的位置 int index EmployeeList SelectedIndex if index 0 return 更新内部数据库 for int i index i Items RemoveAt index EmployeeList Items RemoveAt index EmployeeList SelectedIndex 1 这样当用户点击 删除 按钮时 就可以删除一条员工记录了 6 图片控件 员工的档案里面不能没有员工的照片啊 所以现在来给程序添加一个显示员工照片的控件 选中右侧工具箱里面的 PictureBox 工具 在窗体里面拉出一个照片控件 如下图所示 把它命名为 EmployeePhoto 然后给它添加一个事件处理函数 当用户点击这个控件的时 候 就可以弹出一个对话框 让用户选择它自己的照片 具体添加的代码如下 private System Void EmployeePhoto Click System Object sender System EventArgs e 创建一个打开文件的对话框 OpenFileDialog openFileDialog1 gcnew OpenFileDialog openFileDialog1 InitialDirectory openFileDialog1 Filter Image files jpg jpg All files openFileDialog1 FilterIndex 2 openFileDialog1 RestoreDirectory true if openFileDialog1 ShowDialog System Windows Forms DialogResult OK try 获取照片文件的文件名 g PicName openFileDialog1 FileName 设置图片控件的内容 EmployeePhoto Image System Drawing Image FromFile g PicName catch System OutOfMemoryException e MessageBox Show 这个文件不是图片文件 请重新选择 警告 现在可以试着运行一下程序 看看能不能显示照片 7 更多的功能 现在程序左上角的那个员工列表仅仅是个静态的列表 当你的鼠标点击上去的时候 屏幕 上其它的信息不会随之变动 下面就来给它添加一个切换显示员工信息的功能 当用户点 击不同的员工名字的时候 会显示相对应的员工信息 这需要给 EmployeeList 控件添加一个事件处理函数 让它响应 SelChanged 这个事件 当用 户点击不同的员工名字的时候 会触发这个事件 具体的代码如下 System Void EmployeeListSelChanged System Object sender System EventArgs e if g Index 0 保存当前更改过的信息 g EmployeeList g Index m Name EmployeeName Text if GenderMale Checked g EmployeeList g Index m Gender 男 else g EmployeeList g Index m Gender 女 g EmployeeList g Index m Department Department Text g EmployeeList g Index m Phone Phone Text g EmployeeList g Index m Photo g PicName if IsIntern Checked g EmployeeList g Index m IsIntern 是 else g EmployeeList g Index m IsIntern 否 if g EmployeeCount SelectedIndex EmployeeList SelectedIndex SelectedIndex 更新屏幕上的信息 EmployeeRecord x g EmployeeList g Index EmployeeName Text x m Name if x m Gender 男 GenderMale Checked true else GenderFemale Checked true Department Text x m Department Phone Text x m Phone if x m IsIntern 是 IsIntern Checked true else IsIntern Checked false 更新照片 try if x m Photo EmployeePhoto Image System Drawing Image FromFile x m Photo g PicName x m Photo else EmployeePhoto Image nullptr EmployeePhoto Refresh g PicName catch Exception e 8 完整的示例代码 下面列出了整个程序完整的代码 供读者参考 namespace HRManagement using namespace System using namespace System ComponentModel using namespace System Collections using namespace System Windows Forms using namespace System Data using namespace System Drawing using namespace System Data using namespace System Data OleDb Form1 摘要 警告 如果更改此类的名称 则需要更改 与此类所依赖的所有 resx 文件关联的托管资源编译器工具的 资源文件名 属性 否则 设计器将不能与此窗体的关联 本地化资源正确交互 public ref class Form1 public System Windows Forms Form public array g EmployeeList public int g EmployeeCount String g PicName int g Index private System Windows Forms Label label1 private System Windows Forms ListBox EmployeeList private System Windows Forms TextBox EmployeeName private System Windows Forms Label label2 private System Windows Forms GroupBox EmployeeGender private System Windows Forms RadioButton GenderFemale private System Windows Forms RadioButton GenderMale private System Windows Forms Label label3 private System Windows Forms ComboBox Department private System Windows Forms Label label4 private System Windows Forms TextBox Phone private System Windows Forms CheckBox IsIntern private System Windows Forms Button AddButton private System Windows Forms ListView EmployeeListView private System Windows Forms ColumnHeader col Name private System Windows Forms ColumnHeader col Gender private System Windows Forms ColumnHeader col Department private System Windows Forms ColumnHeader col Phone private System Windows Forms ColumnHeader col IsIntern private System Windows Forms Button DeleteButton private System Windows Forms PictureBox EmployeePhoto public Form1 void InitializeComponent g EmployeeList gcnew array 100 g EmployeeCount 0 g Index 1 GenderMale Checked true protected 清理所有正在使用的资源 Form1 if components delete components private 必需的设计器变量 System ComponentModel Container components pragma region Windows Form Designer generated code 设计器支持所需的方法 不要 使用代码编辑器修改此方法的内容 void InitializeComponent void this label1 gcnew System Windows Forms Label this EmployeeList gcnew System Windows Forms ListBox this EmployeeName gcnew System Windows Forms TextBox this label2 gcnew System Windows Forms Label this EmployeeGender gcnew System Windows Forms GroupBox this GenderFemale gcnew System Windows Forms RadioButton this GenderMale gcnew System Windows Forms RadioButton this label3 gcnew System Windows Forms Label this Department gcnew System Windows Forms ComboBox this label4 gcnew System Windows Forms Label this Phone gcnew System Windows Forms TextBox this IsIntern gcnew System Windows Forms CheckBox this AddButton gcnew System Windows Forms Button this EmployeeListView gcnew System Windows Forms ListView this col Name gcnew System Windows Forms ColumnHeader this col Gender gcnew System Windows Forms ColumnHeader this col Department gcnew System Windows Forms ColumnHeader this col Phone gcnew System Windows Forms ColumnHeader this col IsIntern gcnew System Windows Forms ColumnHeader this DeleteButton gcnew System Windows Forms Button this EmployeePhoto gcnew System Windows Forms PictureBox this EmployeeGender SuspendLayout cli safe cast this EmployeePhoto BeginInit this SuspendLayout label1 this label1 AutoSize true this label1 Location System Drawing Point 21 13 this label1 Name L label1 this label1 Size System Drawing Size 55 13 this label1 TabIndex 0 this label1 Text L 员工列表 EmployeeList this EmployeeList FormattingEnabled true this EmployeeList Location System Drawing Point 16 42 this EmployeeList Name L EmployeeList this EmployeeList Size System Drawing Size 67 186 this EmployeeList TabIndex 1 this EmployeeList SelectedIndexChanged gcnew System EventHandler this EmployeeName this EmployeeName Location System Drawing Point 152 33 this EmployeeName Name L EmployeeName this EmployeeName Size System Drawing Size 93 20 this EmployeeName TabIndex 2 label2 this label2 AutoSize true this label2 Location System Drawing Point 107 35 this label2 Name L label2 this label2 Size System Drawing Size 43 13 this label2 TabIndex 3 this label2 Text L 姓名 EmployeeGender this EmployeeGender Controls Add this GenderFemale this EmployeeGender Controls Add this GenderMale this EmployeeGender Location System Drawing Point 109 71 this EmployeeGender Name L EmployeeGender this EmployeeGender Size System Drawing Size 151 39 this EmployeeGender TabIndex 4 this EmployeeGender TabStop false this EmployeeGender Text L 性别 GenderFemale this GenderFemale AutoSize true this GenderFemale Location System Drawing Point 96 16 this GenderFemale Name L GenderFemale this GenderFemale Size System Drawing Size 37 17 this GenderFemale TabIndex 3 this GenderFemale TabStop true this GenderFemale Text L 女 this GenderFemale UseVisualStyleBackColor true GenderMale this GenderMale AutoSize true this GenderMale Location System Drawing Point 28 16 this GenderMale Name L GenderMale this GenderMale Size System Drawing Size 37 17 this GenderMale TabIndex 2 this GenderMale TabStop true this GenderMale Text L 男 this GenderMale UseVisualStyleBackColor true label3 this label3 AutoSize true this label3 Location System Drawing Point 107 124 this label3 Name L label3 this label3 Size System Drawing Size 43 13 this label3 TabIndex 5 this label3 Text L 部门 Department this Department FormattingEnabled true this Department Items AddRange gcnew cli array 4 L 行政部 L 开发部 L 生产部 L 销售部 this Department Location System Drawing Point 152 121 this Department Name L Department this Department Size System Drawing Size 104 21 this Department TabIndex 6 label4 this label4 AutoSize true this label4 Location System Drawing Point 107 164 this label4 Name L label4 this label4 Size System Drawing Size 43 13 this label4 TabIndex 7 this label4 Text L 电话 Phone this Phone Location System Drawing Point 152 161 this Phone Name L Phone this Phone Size System Drawing Size 107 20 this Phone TabIndex 8 IsIntern this IsIntern AutoSize true this IsIntern Location System Drawing Point 116 203 this IsIntern Name L IsIntern this IsIntern Size System Drawing Size 62 17 this IsIntern TabIndex 9 this IsIntern Text L 实习生 this IsIntern UseVisualStyleBackColor true AddButton this AddButton Location System Drawing Point 28 236 this AddButton Name L AddButton this AddButton Size System Drawing Size 96 23 this AddButton TabIndex 10 this AddButton Text L 添 加 this AddButton UseVisualStyleBackColor true this AddButton Click gcnew System EventHandler this EmployeeListView this EmployeeListView Columns AddRange gcnew cli array 5 this col Name this col Gender this col Department this col Phone this col IsIntern this EmployeeListView FullRowSelect true this EmployeeListView Location System Drawing Point 23 298 this EmployeeListView MultiSelect false this EmployeeListView Name L EmployeeListView this EmployeeListView Size System Drawing Size 494 184 this EmployeeListView TabIndex 11 this EmployeeListView UseCompatibleStateImageBehavior false this EmployeeListView View System Windows Forms View Details col Name this col Name Text L 姓名 col Gender this col Gender Text L 性别 col Department this col Department Text L 部门 col Phone this col Phone Text L 电话 col IsIntern this col IsIntern Text L 实习生 DeleteButton this DeleteButton Location System Drawing Point 151 236 this DeleteButton Name L DeleteButton this DeleteButton Size System Drawing Size 96 23 this DeleteButton TabIndex 12 this DeleteButton Text L 删 除 this DeleteButton UseVisualStyleBackColor true this DeleteButton Click gcnew System EventHandler this Employee
展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 解决方案


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!