第一范文网 - 专业文章范例文档资料分享平台

(完整版)浙江省高校计算机等级考试复习资料——二级VB语言(答案)

来源:用户分享 时间:2025/5/30 17:26:31 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

12. 新建一个工程,完成应用程序的设计。具体要求如下: 参考答案:

Private Sub Command1_Click() End End Sub

Private Sub Form_Load() Command1.Caption = \结束\End Sub

Private Sub Option1_Click() If Option1.Value = True Then

Text1.Text = \今天是\

End If

End Sub

Private Sub Option2_Click() If Option2.Value = True Then

Text1.Text = \今天是\年\End If End Sub

Private Sub Option3_Click() If Option3.Value = True Then

Text1.Text = \今天是\月\End If End Sub

Private Sub Option4_Click() If Option4.Value = True Then

Text1.Text = \今天是\日\End If End Sub

13. 新建一个工程,完成“字体修饰” 程序的设计。具体要求如下: 参考答案:

Private Sub Check1_Click(Index As Integer) If Check1(0).Value = 1 Then Label1.FontBold = True

Else

Label1.FontBold = False End If

If Check1(1).Value = 1 Then Label1.FontItalic = True Else

Label1.FontItalic = False End If End Sub

Private Sub Option1_Click(Index As Integer) If Option1(0).Value = True Then Label1.FontName = \宋体\Else

Label1.FontName = \楷体_GB2312\End If End Sub

14. 新建一个工程,完成“点餐”程序的设计。具体要求如下:

参考答案:

Private Sub Check1_Click(Index As Integer)

If Check1(Index).Value Then '若当前复选框被选中,文本框被启用,同时获得焦点 Text1(Index).Enabled = True Text1(Index).SetFocus End If End Sub

Private Sub Command1_Click() Dim a%, b%, c%, sum% If Check1(0).Value Then a = Val(Text1(0).Text) End If

If Check1(1).Value Then b = Val(Text1(1).Text) End If

If Check1(2).Value Then c = Val(Text1(2).Text) End If

sum = a * 13 + b * 18 + c * 25

MsgBox \一共\元\总价\End Sub

Private Sub Form_Load() Form1.Caption = \点餐\

Form1.BorderStyle = 1 Command1.Caption = \确定\Frame1.Caption = \菜单\

Check1(0).Caption = \儿童套餐馆13元\Check1(1).Caption = \标准套餐18元\Check1(2).Caption = \商务餐25元\Label1(0).Caption = \份数\Label1(1).Caption = \份数\Label1(2).Caption = \份数\Check1(0).Value = 0 Check1(1).Value = 0 Check1(2).Value = 0

Text1(0).Enabled = False Text1(1).Enabled = False Text1(2).Enabled = False End Sub

Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer) If KeyAscii < 48 Or KeyAscii > 57 Then '输入非数字 KeyAscii=0 End If End Sub

15. 新建一个工程,完成应用程序的设计。具体要求如下: 参考答案:

Private Sub Check1_Click() If Check1.Value = 0 Then

Combo1.Enabled = False Text1.Enabled = False Else

Combo1.Enabled = True Text1.Enabled = True End If End Sub

Private Sub Check2_Click() If Check2.Value = 0 Then

Option1.Enabled = False Option2.Enabled = False Else

Option1.Enabled = True

Option2.Enabled = True End If End Sub

Private Sub Command1_Click() If Check1.Value = 1 Then

Label3.Caption = Combo1.Text & Text1.Text End If

If Check2.Value = 1 Then If Option1.Value = 1 Then

Label3.Caption = Label3.Caption & Option1.Caption End If

If Option2.Value = 1 Then

Label3.Caption = Label3.Caption & Option2.Caption End If

End If End Sub

Private Sub Form_Load() Check1.Value = 0 Combo1.Enabled = 0 Text1.Enabled = 0 Check2.Value = 0 Option1.Enabled = 0 Option2.Enabled = 0 End Sub

16. 新建一个工程,完成“改变字号”程序的设计。具体要求如下:

参考答案:

Private Sub Form_Load()

Form1.Caption = \改变字号\End Sub

Private Sub HScroll1_Change() Text1.Text = HScroll1.Value

Label1.FontSize = HScroll1.Value

Label1.Left=Form1.Width/2 - Label1.Width/2 '使用标签在窗体水平居中 End Sub

Private Sub HScroll1_Scroll() Call HScroll1_Change End Sub

Private Sub Text1_Change() Dim i As Integer i = Val(Text1.Text)

If i >= 12 And i <= 72 Then Label1.FontSize = i HScroll1.Value = i End If End Sub

17. 新建一个工程,完成应用程序的设计。具体要求如下: 参考答案:

Private Sub Form_Load()

Label1.Caption = \欢迎您的使用\HScroll1.Value = Label1.Left HScroll1.Min = 0

HScroll1.Max = Form1.ScaleWidth - Label1.Width End Sub

Private Sub HScroll1_Change() Label1.Left = HScroll1.Value End Sub

Private Sub HScroll1_Scroll() HScroll1_Change End Sub

18. 新建一个工程,完成“调色板”程序的设计具体要求如下: 参考答案:

Private Sub Command1_Click()

Label4.ForeColor = Shape1.FillColor End Sub

Private Sub Form_Load() Dim i%

For i = 0 To 2

HScroll1(i).Max = 255 HScroll1(i).Min = 0 Next i

Shape1.FillStyle = 0

Shape1.BorderColor = vbBlack End Sub

Private Sub HScroll1_Change(Index As Integer)

(完整版)浙江省高校计算机等级考试复习资料——二级VB语言(答案).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c4jk4h6dwqg5s23r4b01m9s4tl8lgrm00e4h_4.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top