windows窗体程序的开发实验报告.doc
文本预览下载声明
精通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
{
public Form1( )
{
InitializeComponent( );
}
private void AddInputToLog(string input)
{
this.tbLog.AppendText(\r\n + 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:
源代码:
public 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;
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._CurrF
显示全部