首页 []大学计算机VB实验答案

[]大学计算机VB实验答案

举报
开通vip

[]大学计算机VB实验答案[]大学计算机VB实验答案 计算机VB实验内容 实验二 二、设计题 要求:在完成下列设计题之前请先自我思考,并与旁边的同学讨论: , 要改变Label(标签),Command(命令按钮),Form(窗体)和Text(文本 框)等控件显示的文字应该对应控件的何种属性, , 点击按钮使得标签内容发生变化,我们应当针对标签还是按钮的事件编程, , 了解FontName和FontSize属性的含义 1. 《实践指导》P10,实验1,设计一个加法器程序(请参考本次实验中实例2)。 (程序实际运行效果可参考程序“P...

[]大学计算机VB实验答案
[]大学计算机VB实验答案 计算机VB实验内容 实验二 二、设计题 要求:在完成下列设计题之前请先自我思考,并与旁边的同学讨论: , 要改变Label(标签),Command(命令按钮),Form(窗体)和Text(文本 框)等控件显示的文字应该对应控件的何种属性, , 点击按钮使得标签内容发生变化,我们应当针对标签还是按钮的事件编程, , 了解FontName和FontSize属性的含义 1. 《实践指导》P10,实验1,设计一个加法器程序(请参考本次实验中实例2)。 (程序实际运行效果可参考程序“Prg3.exe” ) 保存要求: (1)在lab02文件夹中新建子文件夹“prg3”,用于保存本题的程序; (2)将本题的工程文件命名为“project3.vbp”,窗体文件命名为“form3.frm”。 注:该题的第5项要求中关于“同时第一个文本框获得焦点”部分不要求实现 过程 Private Sub Command1_Click() Dim a As Single, b As Single, c As Single a = Val(Text1.Text) b = Val(Text2.Text) c = a + b Label2 = c End Sub Private Sub Command2_Click() Text1.Text = "" Text2.Text = "" Label2 = "" End Sub 2. 编写一个标签变化程序(请参考本次实验中实例题1来完成,如下图1所示) (程序实际运行效果可参考程序“Prg4.exe” ) 主要控件如下: 设置控件的名称 设置控件的标题 控件默认设置字 (“Name”)属(“Caption”)属设置控件的其他属性 名称 体大小 性 性 Form1 Form1 我的第一个程序 20磅 Command1 Command1 进入 20磅 Command2 Command2 离开 20磅 字体颜色(ForeColor)红 色,字体为华文彩云 Label1 Label1 请点击按钮 20磅 AutoSize属性为True Alignment属性为2-Center 保存要求: (1)在lab02文件夹中新建子文件夹“prg4”,用于保存本题的程序; (2)将本题的工程文件命名为“project4.vbp”,窗体文件命名为 “form4.frm”。 设计要求: (1)单击窗体(Form1),则窗体打印输出文字“你点击了窗体”(如下图2所示) (2)单击按钮Command1,则在Label1中显示“你点击了按钮Command1,请进入”, 字体大小15磅,字体为宋体(如下图3所示) (3)单击按钮Command2,Label1显示“你点击了按钮Command2,请离开”,字 体大小25磅,字体为黑体(如下图4所示) (图1) (图2) (图3) (图4) 过程 Private Sub Command1_Click() Label1.FontSize = 15 Label1.FontName = "宋体" Label1 = "你点击了按钮Command1,请进入" End Sub Private Sub Command2_Click() Label1.FontSize = 25 Label1.FontName = "黑体" Label1 = "你点击了按钮Command2,请离开" End Sub Private Sub Form_Click() Form1.Print "你点击了窗体" End Sub 实验三 二、设计题 1(《实践指导》P20,实验3。拆数字游戏 保存要求: (1)在lab03文件夹中新建子文件夹“prg3”,用于保存本题的程序; (2)将本题的工程文件命名为“project3.vbp”,窗体文件命名为“form3.frm”。 设计要求: (1)运行“设计题1示例程序.exe”,按照书上的要求设计程序。 (2)具体相关控件在外观方面的属性设置请仔细观察示例程序的效果(窗体的标题栏;单击窗体后弹出的InputBox对话框上的内容) (3)所有控件上的字体大小统一设置为“小四” 过程 Private Sub Form_Click() Dim a As String x = InputBox("请输入一个三位十进制整数", "拆数字", 123) Label4.Caption = Left(x, 1) Label5.Caption = Mid(x, 2, 1) Label6.Caption = Right(x, 1) End Sub 2(《实践指导》P20,实验4。(建议参考理论教材中关于Rnd函数的内容) 保存要求: (1)在lab03文件夹中新建子文件夹“prg4”,用于保存本题的程序; (2)将本题的工程文件命名为“project4.vbp”,窗体文件命名为“form4.frm”。 设计要求: (1)运行“设计题2示例程序.exe”,按照书上的要求设计程序。 (2)具体相关控件在外观方面的属性设置请仔细观察示例程序的效果(如窗体的标题栏) (3)所有控件上的字体大小统一设置为“小四” (4)图2-6中3个显示结果的控件均为标签控件,请将每个标签控件的BorderStyle属性设置为1 过程 Private Sub Command1_Click() Label4.Caption = Str(Rnd) Label5.Caption = Str(Rnd * 9 + 1) Label6.Caption = Str(Int(Rnd * 90) + 10) End Sub 实验四 二、设计题 思考:在完成下列设计题之前请先查阅课本,并与旁边的同学讨论: , IsNumeric函数的功能和用法, , Val函数的用能和用法, , MsgBox函数的功能和用法 , 了解If…else…endif分支语句的用法 1( 按照下面的说明完成本设计题。 说明:输入学生成绩,评定其等级。60~69为及格,70~79为中等,80~89为良好,90以上为优秀,60分以下为“不合格”。(请运行“设计题1示例程序”,了解程序的具体功能) 保存要求: (1)在lab04文件夹中新建子文件夹“prg3”,用于保存本题的程序; (2)将本题的工程文件命名为“project3.vbp”,窗体文件命名为“form3.frm”。 设计要求: (1)程序界面如下图所示: 各控件的主要属性设置如下 关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf 所示: 设置控件的名称 设置控件的标题 设置设置控件的其他属控件默认名称 (“Name”)属(“Caption”)属字体性 性 性 大小 Form1 评定成绩等级 Label1 输入学生成绩 5号 该学生的成绩等级Label2 5号 为: Text1 5号 Text2 5号 Command1 评定等级 5号 注:表中的空单元格表示相应属性无须更改,各控件的其他属性按照默认设置或者自行设置。 (2) 键入下面程序代码并调试通过(注意:以下代码是图片,无法直接拷贝)。 (3) 将代码中的多分支结构语句(红框中的代码)改用Select ……Case语句来 实现(注意:除了红框中的代码,其他代码不能有任何改动)。 过程 Private Sub Command1_Click() Dim strGrade As String Dim x As Single If Not IsNumeric(Text1.Text) Then MsgBox "学生成绩必为数字", vbExclamation, "输入错误" Text1.Text = "" Else x = Val(Text1.Text) Select Case x Case Is >= 90 strGrade = "优秀" Case Is >= 80 strGrade = "良好" Case Is >= 70 strGrade = "中等" Case Is >= 60 strGrade = "及格" Case Else strGrade = "不合格" End Select Text2.Text = strGrade End If End Sub 2(《实践指导》P36,实验2。(请运行“设计题2示例程序”,了解程序的具体功能) 保存要求: (1)在lab04文件夹中新建子文件夹“prg4”,用于保存本题的程序; (2)将本题的工程文件命名为“project4.vbp”,窗体文件命名为“form4.frm”。 设计要求: (1)单击判断按钮弹出MsgBox消息对话框,单击退出按钮结束程序。 注意: (1)文本框中输入的符号必须是英文状态的,比如输入 2,5 (2)在P36页图3-9中,后面的是窗体,前面的是MsgBox消息对话框。 过程 Private Sub Command1_Click() Dim x As Integer Dim y As Integer Dim comma As Integer Dim str As String comma = InStr(Text1.Text, ",") x = Val(Left(Text1.Text, comma - 1)) y = Val(Mid(Text1.Text, comma + 1)) If (x > 0 And y > 0) Then str = "(" & Text1.Text & ")" & "是在第一象限" ElseIf (x < 0 And y > 0) Then str = "(" & Text1.Text & ")" & "是在第二象限" ElseIf (x < 0 And y < 0) Then str = "(" & Text1.Text & ")" & "是在第三象限" ElseIf (x > 0 And y < 0) Then str = "(" & Text1.Text & ")" & "是在第四象限" ElseIf (x = 0 And y <> 0) Then str = "(" & Text1.Text & ")" & "是在y轴上" ElseIf (x <> 0 And y = 0) Then str = "(" & Text1.Text & ")" & "是在x轴上" Else str = "(" & Text1.Text & ")" & "是原点" End If MsgBox str, vbOKOnly + vbInformation, "消息框" End Sub Private Sub Command2_Click() End End Sub 实验五 二、设计题(需上交) 1(《实践指导》P36,实验3。(请运行“设计题1示例程序”,了解程序的具 体功能) 注意: (1)文本框最多接受3个字符是通过设置文本框的MaxLength为3实现 (2)两个文本框均不接受非数字键 可以不做~ 保存要求: (1)在lab05文件夹中新建子文件夹“prg3”,用于保存本题的程序; (2)将本题的工程文件命名为“project3.vbp”,窗体文件命名为“form3.frm”。 过程 Private Sub Command1_Click() Dim bzh As Single, T As Single bzh = Val(Text1.Text) - 105 T = Val(Text2.Text) If T > bzh * 1.1 Then Label5.Caption = "偏胖,加强锻炼,注意节食" ElseIf T < bzh * 0.9 Then Label5.Caption = "偏瘦,增加营养" Else Label5.Caption = "正常,继续保持" End If End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0 End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0 End Sub ,300之间的随机整数(可以出现重复的数字),2(单击窗体,生成20个200 输出其中能被5整除的数,求出它们的和并打印出来。(请运行“设计题2示例程序”,了解程序的具体功能) 保存要求: (1)在lab05文件夹中新建子文件夹“prg4”,用于保存本题的程序; (2)将本题的工程文件命名为“project4.vbp”,窗体文件命名为 “form4.frm”。 设计要求: (1)本程序不要求使用其他控件,只需利用窗体的单击事件Form_Click()即可。 程序运行效果如下图: 过程 Private Sub Form_Click() Dim i As Integer, S As Integer, x As Integer S = o: i = 1 For i = 1 To 20 Randomize x = Int(Rnd * 101 + 200) If x Mod 5 = 0 Then Print x S = S + x End If Next i Print "Sum="; S End Sub 实验六 二、设计题(需上交) 1(《实践指导》P37,实验5,单击窗体,输出表达式的值。(请运行“设计题1示例程序”,了解程序的具体功能) (提示:可以使用 While/Wend或Do/Loop语句。) 保存要求: (1)在lab05文件夹中新建子文件夹“prg3”,用于保存本题的程序; (2)将本题的工程文件命名为“project3.vbp”,窗体文件命名为 “form3.frm”。 设计要求: (1) 精度为0.000001,即当<0.000001时就认为结果符合要求,不必再加。 (2)单击窗体,用Print语句将计算结果在窗体上输出。本程序不要求使用其他控件,只需利用窗体的单击事件Form_Click()即可。程序界面如下图所示。 过程 Private Sub Form_Click() Dim a As Double, b As Integer, c As Long a = 0: b = 1: c = 1 Do While Abs(1 / c) >= 0.000001 a = a + (-1) ^ (b + 1) / c b = b + 1 c = c * b Loop Print a End Sub 2(编写程序,随机产生10个[0,100] 之间的整数,并保存在数组中。求10个整数中的最大值、最小值和10个随机整数的平均值。(请运行“设计题2示例程序”,了解程序的具体功能) 保存要求: (1)在lab06文件夹中新建子文件夹“prg4”,用于保存本题的程序; (2)将本题的工程文件命名为“project4.vbp”,窗体文件命名为“form4.frm”。 设计要求: (1)利用随机函数Rnd()产生10个[0,100]整数。 (2)单击窗体后,用Print语句在窗体上输出10个整数,并打印出10个整数中的最大值、最小值和平均值。 (3)本程序不要求使用其他控件,只需利用窗体的单击事件Form_Click()即可。 程序运行效果如下图: 过程 Private Sub Form_Click() Dim a(1 To 10) As Integer, i As Integer, min As Integer, max As Integer, aver As Single max = 0: min = 100 For i = 1 To 10 a(i) = Int(Rnd * 101) Print a(i); If a(i) > max Then max = a(i) If a(i) < min Then min = a(i) aver = aver + a(i) Next i Print aver = aver / 10 Print "max="; max, "min="; min, "aver="; aver End Sub 实验七 二、设计题(需上交) 1(《实践指导》P37,实验8,单击窗体,统计100个[0,99]范围内的随机整数的个位上的数字的个数。(请运行“设计题1示例程序”,了解程序的具体功能) 保存要求: (1)在lab07文件夹中新建子文件夹“prg3”,用于保存本题的程序; (2)将本题的工程文件命名为“project3.vbp”,窗体文件命名为“form3.frm”。 设计要求: (1) 单击窗体,用Print语句将计算结果在窗体上输出。本程序不要求使用其他控件,只需利用窗体的单击事件Form_Click()即可。程序界面如下图所示。 过程 Option Explicit Private Sub Form_Click() Dim x(0 To 9) As Integer, i As Integer, j As Integer, h As Integer Randomize For i = 1 To 100 j = Int(Rnd * 100) h = j Mod 10 x(h) = x(h) + 1 Next For h = 0 To 9 Print "个位上的数字为"; h; "的个数为:"; x(h) Next End Sub 2(用InputBox函数输入5个任意整数,按从小到大的顺序输出。可参考《Visual Basic程序设计基础(教材)》P76,例3-28。(请运行“设计题2示例程序”,了解程序的具体功能) 保存要求: (1)在lab07文件夹中新建子文件夹“prg4”,用于保存本题的程序; (2)将本题的工程文件命名为“project4.vbp”,窗体文件命名为“form4.frm”。 设计要求: (1)利用选择法或冒泡法进行排序。 (2)单击窗体后,用Print语句在窗体上输出原始序列,然后再打印出排序后的序列。 程序运行效果如下图: 过程 Private Sub Form_Click() Dim a(1 To 5) As Integer, i As Integer, k As Byte, j As Byte, temp As Single For i = 1 To 5 a(i) = InputBox("输入第" & Str(i) & "个任意整数", "project4") Next i For i = 1 To 5 Print a(i); Next i Print For i = 1 To 4 k = i For j = i + 1 To 5 If a(j) < a(k) Then k = j Next j temp = a(i): a(i) = a(k): a(k) = temp Next i For i = 1 To 5 Print a(i); Next i Print End Sub 实验八 二、设计题(需上交) 1(编写程序,打印乘法99表。(请运行“设计题1示例程序”,了解程序的具体功能) 保存要求: (1)在lab08文件夹中新建子文件夹“prg3”,用于保存本题的程序; (2)将本题的工程文件命名为“project3.vbp”,窗体文件命名为 “form3.frm”。 设计要求: (1)本程序只用到两个按钮,将按钮控件和窗体的FontSize属性设置为“四号”。 (2)编写子过程cfb1(),单击“打印乘法表1”按钮调用该过程,效果如下图所示。 (3) 编写子过程cfb2(),“打印乘法表2”按钮调用该过程,效果如下图所示。 过程 Option Explicit Private Sub Command1_Click() Cls Call cfb1 End Sub Private Sub Command2_Click() Cls Call cfb2 End Sub Public Sub cfb1() Dim i As Integer, j As Integer, s As String For i = 1 To 9 For j = 1 To 9 s = i & "×" & j & "=" & i * j Print " " & s; Next j Print Next i End Sub Public Sub cfb2() Dim i As Integer, j As Integer, s As String For i = 1 To 9 For j = 1 To i s = i & "×" & j & "=" & i * j Print " " & s; Next j Print Next i End Sub 2(编写一程序,大圆半径10cm,在它上面分别剪下半径分别为3cm和5cm的两个小圆,求大圆剩下部分的面积。要求编写用户自定义函数来解决。(请运行“设计题2示例程序”,了解程序的具体功能) 保存要求: (1)在lab08文件夹中新建子文件夹“prg4”,用于保存本题的程序; (2)将本题的工程文件命名为“project4.vbp”,窗体文件命名为“form4.frm”。 设计要求: (1) 单击窗体后利用InputBox函数输入3个圆的半径; (2) 将结果用print语句在窗体上输出; (3) 本程序不要求使用其他控件,只需利用窗体的单击事件Form_Click()即可; (4) 本程序已给出部分代码,请在每条下划线的位置上填一行合适的语句,将程序补充完整并调试通过。程序运行效果如下图: 完成如下程序中8处划线位置的代码: 过程 Option Explicit Private Sub Form_Click() Dim r1 As Integer Dim r2 As Integer Dim r3 As Integer Dim result As Single r1 = InputBox("请输入大圆的半径:", "给r1赋值") r2 = InputBox("请输入第一个小圆的半径:", "给r2赋值") r3 = InputBox("请输入第二个小圆的半径:", "给r3赋值") result = Sarea(r1) - Sarea(r2) - Sarea(r3) Print "大圆的半径为:" & r1 & "cm" Print "第一个小圆的半径为:" & r2 & "cm" Print "第二个小圆的半径为:" & r3 & "cm" Print "大圆减去两个小圆后,剩下的面积是:" & result & "平方厘米" End Sub Public Function Sarea(ByVal r As Integer) As Single Dim s As Single s = 3.14 * r ^ 2 Sarea = s End Function 三、思考题(选做题,不用上交) 1(子过程和函数有何区别, 2.《实践指导》P49,实验1。 3.《实践指导》P50,实验3。 实验九 二、设计题(需上交) 1(《实践指导》P66,实验1,设置密码。(请运行“设计题1示例程序”,了解程序的具体功能) 保存要求: (1)在lab09文件夹中新建子文件夹“prg3”,用于保存本题的程序; (2)将本题的工程文件命名为“project3.vbp”,窗体文件命名为“form3.frm”。 设计要求: (1)本程序用到两个标签、两个文本框和一个命令按钮控件。 (2)图5-9的第三幅图中显示的两行提示文字有换行效果。 在消息对话框中实现文字换行的代码实例如下: 单击窗体中的Command1,弹出对话框(文字换行显示) 实现代码: Private Sub Command1_Click() MsgBox "消息对话框" & Chr(13) & "换行显示", , "Test" End Sub 过程 Private Sub Command1_Click() If Text1.Text = Text2.Text Then MsgBox "密码设置成功" & Chr(13) & "你的密码是" & Text1.Text, , "sy5-1" Text1.Enabled = False Command1.Enabled = False Text2.Enabled = False Else MsgBox "两次密码不一样,设置不成功,请重新设置", , "project1" Text1.Text = "" Text2.Text = "" Form_Load End If End Sub Private Sub Form_Load() Command1.Visible = False Label2.Visible = False Text2.Visible = False End Sub Private Sub text1_keypress(KeyAscii As Integer) If KeyAscii = 13 Then If Len(Str(Text1.Text)) >= 6 Then Command1.Visible = True Label2.Visible = True Text2.Visible = True Text2.PasswordChar = "*" Else Text1.Text = "" MsgBox "密码至少要6位以上", , "project1" End If End If End Sub Private Sub Text2_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Command1.Value = True End If End Sub 2(《实践指导》P67,实验3,修饰文本框中的显示文本。(请运行“设计题1示例程序”,了解程序的具体功能) 保存要求: (1)在lab09文件夹中新建子文件夹“prg4”,用于保存本题的程序; (2)将本题的工程文件命名为“project4.vbp”,窗体文件命名为 “form4.frm”。 设计要求: (1) 本程序用到一个文本框、两个复选框、三个单选按钮和一个框架控件。 (2) 该题可参考教材第五章中关于单选按钮和复选框的例题进行设计 (3) 设置文本框的对齐属性是Alignment,该属性的值是整型,0代表左对齐,1 代表右对齐,2代表居中 过程 Private Sub Check1_Click() If Check1.Value = 1 Then Text1.BackColor = vbYellow Else Text1.BackColor = vbWhite End If End Sub Private Sub Check2_Click() If Check2.Value = 1 Then Text1.FontBold = True Else Text1.FontBold = False End If End Sub Private Sub Option1_Click() Text1.Alignment = 0 End Sub Private Sub Option2_Click() Text1.Alignment = 2 End Sub Private Sub Option3_Click() Text1.Alignment = 1 End Sub 实验十 二、设计题(需上交) 1(编写程序,验证组合框和列表框的功能。(请运行“设计题2示例程序”,了解程序的具体功能) 保存要求: (1)在lab10文件夹中新建子文件夹“prg3”,用于保存本题的程序; (2)将本题的工程文件命名为“project3.vbp”,窗体文件命名为“form3.frm”。 设计要求: (1)单击“添加”按钮,若文本框Text1.Text中不是空格串,并且列表中也没有,则将该课程添加列表框中,否则提示用户“该项已存在,请勿重复添加” (2)单击“删除”按钮,删除列表框中被选中的内容以及显示在文本框中相应的课程名称; (3)单击“统计”按钮,统计列表框中有几门课程,并显示在文本框Text2.text中 (4)单击“结束”按钮,结束程序运行 程序效各控件的主要属性设置: 设置控件的名称 设置控件的标题 设置字 控件默认名称 设置控件的其他属性 (“Name”)属性 (“Caption”)属性 体大小 AutoSiz属性设为Label1 课程列表 True AutoSiz属性设为Label2 课程数量 True Text1 Text2 Command1 CmdAdd Command2 CmdDelete Command3 CmdCount Command4 CmdEnd ListBox lstCourse 注:表中的空单元格表示相应属性无须更改,各控件的其他属性按照默认设置或自行设置 界面效果如下图所示: 运行后界面效果如下图所示: 窗体加载部分程序代码如下: 过程 Private Sub CmAdd_Click() Dim i As Integer If Trim(Text1.Text) = "" Then MsgBox "不能添加空格或空字符串" Text1.Text = "" Else For i = 0 To lstCourse.ListCount - 1 If lstCourse.List(i) = Text1.Text Then MsgBox "该项已经存在,请勿重复添加" Exit For End If Next If i > lstCourse.ListCount - 1 Then lstCourse.AddItem Text1.Text End If End Sub Private Sub CmdCount_Click() Text2.Text = lstCourse.ListCount End Sub Private Sub CmdDelete_Click() Text1.Text = "" If lstCourse.ListIndex <> -1 Then lstCourse.RemoveItem (lstCourse.ListIndex) Else MsgBox "请先选择课程名称,然后再执行删除操作" End If End Sub Private Sub CmdEnd_Click() End End Sub Private Sub Form_Load() lstCourse.AddItem "计算机基础" lstCourse.AddItem "vb程序设计" lstCourse.AddItem "网络技术基础" End Sub 2(编写程序,利用定时器,制作一个字幕滚动程序。(请运行“设计题2示例程序”,了解程序的具体功能) 保存要求: (1)在lab10文件夹中新建子文件夹“prg4”,用于保存本题的程序; (2)将本题的工程文件命名为“project4.vbp”,窗体文件命名为“form4.frm”。 设计要求: (1)界面设计如下图所示: (2)单击“开始左移”按钮,Label1“欢迎使用VB6.0”开始向左移动;当Label1 移出窗体之后,其又从窗体右边进入。 (3)单击“开始右移”按钮,Label1“欢迎使用VB6.0”开始向右移动;当Label1 移出窗体之后,其又从窗体左边进入。 (4)单击“停止”按钮,Label1停止移动。 (5)每次Timer事件,Label1的移动量设置为300 各控件的主要属性设置: 设置控件的名称 设置控件的标题 设置字 控件默认名称 设置控件的其他属性 (“Name”)属性 (“Caption”)属性 体大小 Form1 定时器的使用 Label1 小二 AutoSize=True Command1 开始左移 Command2 停止 Command3 开始右移 Interval=100 Timer1 Enabled=False 过程 Dim flag As Boolean Private Sub Command1_Click() Timer1.Enabled = True flag = True End Sub Private Sub Command2_Click() Timer1.Enabled = False End Sub Private Sub Command3_Click() Timer1.Enabled = True flag = False End Sub Private Sub Form_Load() Timer1.Enabled = False End Sub Private Sub Timer1_Timer() If flag = True Then If Label1.Left < -Label1.Width Then Label1.Left = Form1.Width Else Label1.Left = Label1.Left - 300 End If Else If Label1.Left > Form1.Width Then Label1.Left = -Label1.Width Else Label1.Left = Label1.Left + 300 End If End If End Sub 实验十一 二、设计题(需上交) 1(编制事件过程Form_Click,以窗体中心点为坐标原点,以窗体的高与宽中最小值的1/3为半径画一个圆。(请运行“设计题1示例程序”,了解程序的具体功能) 保存要求: (1)在lab11文件夹中新建子文件夹“prg3”,用于保存本题的程序; (2)将本题的工程文件命名为“project3.vbp”,窗体文件命名为“form3.frm”。 设计要求: (1)圆的轮廓线为蓝色forecolor,内部黄色填充fillcolor。 (2)主要属性设置(以下属性设置要求在Form_Load事件中完成): 控件默认名FillStyleScaleMode属性 DrawWidth属性 FillColor属性 称 属性 0实物填 Form1 6 8 充,使黄色vbYellow 显现出来 (3) 界面效果如下图所示: (4) 完成上述程序后,将Form1.DrawWidth的值由8改为2并查看运行效果。 (5) 完成上述程序后,将Form1. FillStyle的值由分别改为1-5并查看运行效果。 过程 Private Sub Form_Click() Cls Dim radius As Single, x As Single, y As Single If Form1.ScaleHeight < Form1.ScaleWidth Then radius = Form1.ScaleHeight / 3 Else radius = Form1.ScaleWidth / 3 End If x = Form1.ScaleLeft + Form1.ScaleWidth / 2 y = Form1.ScaleTop + Form1.ScaleHeight / 2 Circle (x, y), radius, vbBlue End Sub Private Sub Form_Load() Form1.ScaleMode = 6 Form1.DrawWidth = 8 Form1.FillStyle = 0 Form1.FillColor = vbYellow End Sub 2(编制四个按钮点击事件过程,使得在屏幕的四个图片框控件中显示如下一组图形。(请运行“设计题2示例程序”,了解程序的具体功能) 保存要求: (1)在lab11文件夹中新建子文件夹“prg4”,用于保存本题的程序; (2)将本题的工程文件命名为“project4.vbp”,窗体文件命名为“form4.frm”。 设计要求: (1)运行结果如下图所示: (2) 在窗体上放置如下控件,并设置相关属性 控件 Caption属性 Height、Width属性 备注 Picture1 用于画线段 Picture2 用于画圆 Height、Width属性 均设置为1800 Picture3 用于画圆弧 Picture4 用于画扇形 Command1 画线段 Command2 画圆 Command3 画圆弧 Command4 画扇形 (3) 绘制内容: a) 在Form_Load()中,统一重新定义所有图片框的坐标,左上角坐标为(-10, 10),右下角坐标为(10,-10); b) 单击Command1,在第一个图片框控件内绘制一条折线,拐点在图片框中 心点; c) 单击Command2,在第二个图片框控件内绘制以中心点为圆心半径为5的 实心圆; d) 单击Command3,在第三个图片框控件内绘制起始角为π/4,终止角为 π的圆弧; e) 单击Command4,在第四个图片框控件内绘制起始角为π/4,终止角为 π的扇形。 (4) 注意: a) 设置图片框的坐标系请参考《教材》P173页中关于Scale方法的描述 b) 因Picture2和Picture4中的图形有填充色,所以要设置FillStyle属 性 c) 绘制Picture3中的圆弧请参考《教材》P181页中关于画圆弧的描述 d) 绘制Picture4中的扇形请参考《教材》P181页中关于画圆弧的描述 过程 Private Sub Command1_Click() Picture1.Line (-10, 10)-(0, 0) Picture1.Line (0, 0)-(-10, -10) End Sub Private Sub Command2_Click() Picture2.FillStyle = 0 Picture2.Circle (0, 0), 5 End Sub Private Sub Command3_Click() Picture3.FillStyle = 0 Picture3.Circle (0, 0), 5, , 3.14159 / 4, 3.14159 End Sub Private Sub Command4_Click() Picture4.FillStyle = 0 Picture4.Circle (0, 0), 5, , -3.14159 / 4, -3.14159 End Sub Private Sub Form_Load() Picture1.Scale (-10, 10)-(10, -10) Picture2.Scale (-10, 10)-(10, -10) Picture3.Scale (-10, 10)-(10, -10) Picture4.Scale (-10, 10)-(10, -10) End Sub 大学英语四级写作十种常考类型作文及范文: 1、致辞 2、求职信/求学信 3、邀请信 4、个人 简历 个人简历下载免费下载简历模版总经理简历下载资料员简历下载资料员简历下载 5、告示 6、就业 7、考试 8、读后 感9、难忘的人10、 论述文框架 1、致辞 Directions: Write a speech on the opening of a conference of no less than 120 words. In your speech, you should:1、进行自我介绍,2、详细介绍大会内容,3、结束语。 Good morning, ladies and gentlemen, welcome to Beijing! To begin with, I would like to make a brief introduction to myself. I am the president of Motorola (China) Electronics Ltd. The following is my introduction to the conference. First, it is my great honor to be here with all of you and declare open the Conference of International Trade Cooperation. Second, on behalf of our company, I would like to express my heartfelt welcome to all the guests and delegates. Last, I believe our cooperative efforts are sure to be productive. I wish all of you enjoy yourselves during this conference and hope the above information will help you. If you have any question for me, please feel free to ask at any time. Thank you for your attention. 2、求职信/求学信: Directions: For this part, you are allowed 30 minutes to write a letter applying for a position of a company. You should write at least 120 words according to the outline given below in Chinese: 1、申请职位,2、简要介绍自己的情况,3、期待回信。 Dear Sir or Madam, I am senior from the Department of Business Administration of Beijing University. I am writing the letter in purpose of applying for admission into your esteemed institution/your recently advertised position for a staff member. I am sure that I am qualified for it. First, enclosed with this letter is my resume, which further details my previous academic qualifications and work experience. Second, not only do my qualifications and experience make me a perfect candidate for it, my cheerful personality is well suited to studying in your prestigious university/working as a staff member. Last, my hobbies include sports and music. Words fail me when I try to express my heartfelt gratitude to the help you rendered me. Your prompt and favorable attention to my inquiry would be highly appreciated. Yours sincerely, Li Ming 3、邀请信: Directions: You want to invite some friends to a party. Write an invitation letter to them individually:1、邀请参加晚会,2、说明举办晚会的原因,3、将安排哪些活动。 Dear Wangcai, I am greatly honored to formally invite you to participate in Mr. Old Fish’s wedding ceremony with Ms. Fujiwora to be held at Beijing Grand Hotel from 8 to 10 p.m. on April 1, 2007. As you are a close friend of us, we would very much like you to attend the celebration and share our joy. The occasion will start at seven o’clock in the evening, with the showing of their wedding ceremony. This will be followed by a dinner party. At around ten, we will hold a small musical soiree, at which a band will perform some works by Bach and Strauss. If you do not have any prior appointment on April 1, we look forward to the pleasure of your company. Yours sincerely, Li Ming 4、个人简历: 1、致辞: Directions: Write of resume of yourself of no less than 120 words. In it, you should:1、说明姓 名、地址、联系方式、求职目标,2、教育背景、工作经历、资历,3、所获奖励、特长,以 及个人 资料 新概念英语资料下载李居明饿命改运学pdf成本会计期末资料社会工作导论资料工程结算所需资料清单 。 RESUME Li Ming P. O. Box 237, Beijing University 5, Yiheyuan Road, Haidian District, Beijing 100871 Tel: 62768888 Email: liming@163.com Career Objective: A position with management potential in the banking business specializing in international corporate financing Educational Background: Sept 2003 to Beijing University July 2007 Major in International Business Management Main courses include English, computer,Business Management, Accounting, International Commercial Law Work Experience: July 2006 to Bank of China June 2007 Internship, Secretary to Deputy Manager of Marketing Draft business correspondence Schedule deputy manager’s appointments Qualifications: University graduation certificate and bachelor degree to be conferred upon graduation (2007) College English Test Band 4 June 2005 Honors & Awards: Twice awarded scholarship by Beijing University 2005& 2006 Special Skills: Familiarity with Microsoft Word, Excel Ability to work independently Outstanding Organizational skills Experience: President of Student Union 2003-present Personal Data: Date of Birth: Sep. 17, 1984 Gender: Female Marital Status: Unmarried 5、告示: Directions: The Students’ Union of your department is planning a Chinese Speaking Contest. Write an announcement which covers the following information:1、比赛目的、时间、地点,2、 参赛者的要求,3、裁判和奖励的细节。 You should write about 120 words. Do not sign your own name at the end of the letter. Use Department of Chinese Language and Literature at the end of the announcement. Chinese Speaking Contest December 22, 2007 To improve students’ ability to speak Chinese and enrich after-class activities, the Students’ Union of Department of Chinese Language and Literature is organizing a school-wide Chinese speaking contest to be held on Saturday next week (29 December) at the Students’ Auditorium. Those who are interested in taking part in it may sign up with the monitor of their classes before Tuesday next week. Five professors will be invited to be judges. The first six winners will be given awards. Everybody is welcome to be present at the contest. The Students’ Union Department of Chinese Language and Literature 6.就 业: Directions: For this part you are allowed 30 minutes to write a composition on the topic Jobs for Graduates. You should write at least 120 words and base your composition on the outline below: 1、大学生难找工作,2、原因很多,3、解决的办法。 Job hunting has always been a headache for college students. Though many graduates are employed right after graduation, some are not. Most serious of all, some still have no idea where to go working even a long time after graduation. The reasons for this phenomenon are various. On the one hand, a few years ago colleges and universities enrolled so many students in popular majors, such as economy, finance and so on that the number of graduates was greater than the need in the market. On the other hand, most graduates would rather stay in large cities without suitable job to do than go to the country. I reckon this problem can be solved if both colleges and students take measures. First, they should research the market and develop special skills to suit its need. Second, students’ attitude towards employment should be changed. They should go to small cities and country. There they can also give full play to their professional knowledge. In a word, if we pay much attention, the situation can be improved. 7、考试: Directions: For this part you are allowed 30 minutes to write a composition on the topic My Views on Examinations. You should write at least 120 words and base your composition on the outline below:1、大学都用考试来衡量学生的成绩,2、考生可能带来的副作用,3、我对考 试的看法。 In most colleges and universities the examination is used as a chief means of deciding whether a student succeeds or fails in mastering a particular subject. Although it does the job quite efficiently, its side effects are also enormous. To begin with, examinations lower the standards of teaching. Since teachers are often judged by examination results, they are reduced to training their students in exam techniques. No subjects can be taught successfully merely through being approached with intent to take examinations. In addition, the most undesirable effect is that examinations encourage bad study habits. As the examination score is the only criterion for his academic performance, a student is driven to memorize mechanically rather than to think creatively. In fact, few of us admit that examinations can contribute anything really important to the students’ academic development. If that is the case, why cannot we make a change and devise something more efficient and reliable than examinations? 8、读后感: Directions: For this part you are allowed 30 minutes to write a composition on the topic My Favorite Novel. You should write at least 120 words and base your composition on the outline below:1、我最喜爱的小说,2、该小说的内容,3、我为什么喜爱。 My favorite novel is Around the World in Eighty Days which is written by Jules Verne. The author was born in France and devoted himself to literature and wrote several scientific romances, which gained him the name——Father of Modern Science Fiction. This is a book of science fiction which tells us an exciting story about an English gentleman, Mr. Phileas Fogg, who makes a bet with his clubmates and manages to travel around the world in eighty days. It gives us a vivid description of the many difficulties and incidents which happen on his journey. From this story, we can see the author’s deep love for the sea, travel and adventure, which played a vital role in his life. We are also astonished and convinced by his fertile imagination and scientific and geographical knowledge. 9、难忘的人: Directions: For this part you are allowed 30 minutes to write a composition on the topic The most unforgettable Person I ever Know. You should write at least 120 words and base your composition on the outline below:1、我生活中最难忘的人是,2、为什么他(或她)令我难以 忘怀,3、结论。 In my life I have met a great many people who are really worth recalling. But perhaps the most unforgettable person I ever know is my English teacher. What frequently brings back memories of my school teacher is his special qualities. First and foremost, he gave us the greatest gift a teacher can offer—an awakening of a passion for learning. He not only led us to an appreciation of the beauty and perfection of English language and literature, but also aroused our great interest in exploring something deeper in this field. Furthermore, I was attracted by his lively wit. I remember that we students always anticipated his class with great eagerness because his lecture were humorously delivered, never failing to provoke chuckles or loud laughs. Although it is nearly two years since I attended his last class, he is the talk of our old classmates, and I know part of him has already stayed in my heart. 10、论述文框架: Owing to the speedy economic development, the number of people who…has considerably increased/declined. It is universally acknowledged that … plays a crucial role in modern society. Due attention has to be paid to the issue of…. With the reform and opening-up in recent decades,people in mounting numbers have come to realize the significance of …. If we let this situation continue as it is, we do not know where humans will be in the forthcoming future. Accordingly, it is imperative for us to take drastic measures. To begin with, we should appeal to the authorities to make strict laws to …. In addition, we should cultivate the awareness of people that … is essential to us. Only in this way can we reverse this disturbing trend illustrated above.
本文档为【[]大学计算机VB实验答案】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_196623
暂无简介~
格式:doc
大小:404KB
软件:Word
页数:46
分类:生活休闲
上传时间:2017-10-16
浏览量:78