实验报告课程名称面向对象程序设计实验名称实验五、控件使用日期学生学号姓名班级实验目的:1.掌握窗体的常用属性的使用。2.掌握文本操作类控件中的标签控件和文本控件的使用。3.掌握选择操作类控件中的复选框、单选框、列表框、组合框的使用。实验要求:1.认真阅读、掌握和本实验相关的教材内容。2.设计并编写代码完成题目要求的任务。3.撰写实验报告。实验内容与步骤:1.多窗体练习实现如图所示功能。输入用户名后点击登录按钮,弹出右图消息框。要求在消息框中显示用户输入的用户名和“欢迎你”语句。点击取消按钮结束程序运行。源代码:在窗体form1里面添加如下代码:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceshiyan5{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}privatevoidbutton1_Click(objectsender,EventArgse){MessageBox.Show(this.textBox1.Text+"欢?迎?-你?!ê?","提?¨¢示o?消?息?é",MessageBoxButtons.OK,MessageBoxIcon.Information);}privatevoidbutton2_Click(objectsender,EventArgse){this.Close();}}}2.文本框,标签和按钮练习实现如图所示功能。点击红色按钮,将文本框中的文字颜色变成红色,同时把该按钮变成不可用(提示:修改按钮的Enabled属性为false使其不可用);点击黑色按钮,将文本框中的文字颜色变成黑色,同时把该按钮变成不可用;点击“文本内容复制到标签”将文本框内容复制到下方标签。源代码:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceshiyan5_2{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}privatevoidbutton1_Click(objectsender,EventArgse){textBox1.ForeColor=System.Drawing.Color.Red;this.button1.Enabled=false;}privatevoidbutton2_Click(objectsender,EventArgse){textBox1.ForeColor=System.Drawing.Color.Black;this.button2.Enabled=false;}privatevoidbutton3_Click(objectsender,EventArgse){label1.Text=textBox1.Text;}}}3.定时器练习在窗体中显示字符,每隔1秒字符移动一定距离,先右移,移到右边界,再左移,移到左边界,又一次右移,如此循环。(提示:修改标签的Left属性值)源代码:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceshiyan5_3{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}privateboolMoveToRight=true;privatevoidtimer1_Tick(objectsender,EventArgse){intx=label1.Location.X;inty=label1.Location.Y;intincrement=10;if(MoveToRight)if((x+label1.Size.Width)+increment>=this.ClientRectangle.Width)MoveToRight=false;elselabel1.Location=newPoint(x+increment,y);if(!MoveToRight)if(x-increment<=0)MoveToRight=true;elselabel1.Location=newPoint(x-increment,y);}}}4.复选框、单选框、组合框练习实现如图所示的功能。要求对相应控件做了设置之后,马上见到对应的字体效果。清除按钮用来清除文本框中的文字内容,退出按钮用来退出程序。源代码:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceshiyan5_4{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}privatevoidbutton2_Click(objectsender,EventArgse){this.Close();}privatevoidbutton1_Click(objectsender,EventArgse){textBox1.Text="";}privatevoidradioButton1_CheckedChanged(objectsender,EventArgse){textBox1.Font=newSystem.Drawing.Font("...