windows窗体程序开发实验报告

上传人:第*** 文档编号:61714932 上传时间:2018-12-10 格式:DOC 页数:15 大小:431KB
返回 下载 相关 举报
windows窗体程序开发实验报告_第1页
第1页 / 共15页
windows窗体程序开发实验报告_第2页
第2页 / 共15页
windows窗体程序开发实验报告_第3页
第3页 / 共15页
windows窗体程序开发实验报告_第4页
第4页 / 共15页
windows窗体程序开发实验报告_第5页
第5页 / 共15页
点击查看更多>>
资源描述

《windows窗体程序开发实验报告》由会员分享,可在线阅读,更多相关《windows窗体程序开发实验报告(15页珍藏版)》请在金锄头文库上搜索。

1、精通C#与.NET4.0数据库开发实验报告实验题目:Windows窗体程序的开发专 业 计算机科学与技术 学 生 姓 名 班 级 学 号 教 师 指 导 单 位 日 期 教师评语 教师签名: 年 月 日成绩评定备 注一、实验目的1. 学会在Visual Studio 2010中创建和运行窗体程序。2. 掌握Windows窗体的基本操作。3. 学会使用常用的Windows控件。4. 学会使用菜单和工具栏以及通用对话框。二、实验环境.NET框架开发环境 Visual Studio 2010三、实验内容例5-1、2:源代码: public partial class Form1 : Form pub

2、lic Form1( ) InitializeComponent( ); private void AddInputToLog(string input) this.tbLog.AppendText(rn + input); this.tbLog.ScrollToCaret( ); private void btnSubmit_Click(object sender, EventArgs e) string input = this.tbInput.Text; this.AddInputToLog(input); this.tbInput.Clear( ); 例5-3、4: 源代码:publi

3、c partial class FrmMain : Form public FrmMain( ) InitializeComponent( ); private void btnSetProp_Click(object sender, EventArgs e) this.Text = 测试对话框; this.FormBorderStyle = FormBorderStyle.FixedDialog; this.BackColor = Color.Gray; this.WindowState = FormWindowState.Normal; this.MinimizeBox = false;

4、this.Height = 200; this.Width = 400; this.TopMost = true; private FrmMain _CurrFrm = null; private void btnCreate_Click(object sender, EventArgs e) if(this._CurrFrm = null) this._CurrFrm = new FrmMain( ); this._CurrFrm.Show( ); else this._CurrFrm.Activate( ); private void btnClose_Click(object sende

5、r, EventArgs e) if (this._CurrFrm != null) this._CurrFrm.Close( ); this._CurrFrm = null; private void FrmMain_Load(object sender, EventArgs e) 例5-5:源代码:/ label1参数设置 this.label1.AutoSize = true; this.label1.BackColor = System.Drawing.Color.Red; this.label1.Font = new System.Drawing.Font(楷体_GB2312, 12

6、F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)(134); this.label1.ForeColor = System.Drawing.Color.White; this.label1.Location = new System.Drawing.Point(68, 43); this.label1.Name = label1; this.label1.Size = new System.Drawing.Size(232, 16); this.label1.TabIndex = 0;

7、this.label1.Text = 红底白字,楷体 小四号, 无边框; this.label1.Click += new System.EventHandler(this.label1_Click); / label2参数设置 this.label2.AutoSize = true; this.label2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.label2.Font = new System.Drawing.Font(幼圆, 15F, System.Drawing.FontStyle.Bold, S

8、ystem.Drawing.GraphicsUnit.Point, (byte)(134); this.label2.Location = new System.Drawing.Point(49, 79); this.label2.Name = label2; this.label2.Size = new System.Drawing.Size(289, 22); this.label2.TabIndex = 1; this.label2.Text = 幼圆 小三 粗体, Single 边框; this.label2.Click += new System.EventHandler(this.

9、label2_Click);例5-6: 源代码:public partial class Form1 : Form private int _Value = 0; /btnShowMsg的Click事件处理函数 private void btnShowMsg_Click(object sender, EventArgs e) MessageBox.Show(string.Format(现在需要: 0 , this._Value); /“多一点”按钮Click事件处理函数 private void btnAdd_Click(object sender, EventArgs e) this._Value+; this.lbRes.Text = string.Format(现在需要: 0 , this._Value); /“少一点”按钮Click事件处理函数 private void btnSub_Click(object sender, EventArgs e) this._Value-; this.lbRes.Text = string.Format(现在需要: 0 , this._Value); 例5-7:源代码:public partial class Form1 : Form public Form1( ) InitializeComponent( ); private

展开阅读全文
相关资源
相关搜索

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

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号