VB上机操作题综合 - 图文 下载本文

VB程序设计—《暴风影音》

程序运行前:

程序运行后:

说明:当用户双击窗体任意区域时,播放器窗口最大化。 提示:窗体最大化可使用语句:Form1.windowstate = 2 详细内容:

程序使用控件如下:

窗体(Form)1个。 控件属性设置:

Form1 Caption BackColor

暴风影音 黑色

1 / 44

参考代码:

Private Sub Form_DblClick() Form1.WindowState = 2 End Sub

VB程序设计—《登录框》

程序运行:

说明:制作如图所示登录框,其中,用户名限制输入6位长度,密码以“*”号显示。

详细内容:

程序使用控件如下:

窗体(Form)1个,标签(Label)2个,文本框(TextBox)2个,按钮(Command Button)2个。 控件属性设置:

Form1 Caption Label1 Caption Font Text1 Text

登录框 用户名 小三 清空

Label2 Caption Font Text2 Text

2 / 44

密 码 小三 清空

Font

MaxLength Command1 Caption Font

小三 6 登录 小三

Font

Passwordchar Command2 Caption Font

小三 *

退出 小三

VB程序设计—《静夜思》

程序运行:

说明:当用户点击程序中的“显示诗句”按钮时,程序相应位置显示对应诗句.

程序使用控件如下:

窗体(Form)1个,标签(Label)5个,按钮(CommandButton)4个。 控件属性设置:

Form1 Caption Label2 Caption Font Visible

诗词记忆练习

床前明月光, 小二,隶书 False

Label1 Caption Font Label3 Caption Font Visible

静夜思 一号,隶书 疑是地上霜。 小二,隶书 False

Label4 Caption Font Visible Command1

举头望明月, 小二,隶书 False

Label5 Caption Font Visible Command2

3 / 44

低头思故乡。 小二,隶书 False

Caption Font Command3 Caption Font

显示诗句 三号 显示诗句 三号

Caption Font Command4 Caption Font

显示诗句 三号 显示诗句 三号

参考代码:

Private Sub Command1_Click() Label2.Visible = True End Sub

Private Sub Command2_Click() Label3.Visible = True End Sub

Private Sub Command3_Click() Label4.Visible = True End Sub

Private Sub Command4_Click() Label5.Visible = True End Sub

Private Sub Form_Load() End Sub

VB订餐

4 / 44

运前 运行

功能:当单击窗体上的“计算金额”命令按钮时,弹出如图所示消息框MsgBox,并显示相应消费金额。

参考代码:

Private Sub Command1_Click()

Dim a As Integer, b As Integer, c As Integer, d As Integer, S As Integer a = Val(Text1) b = Val(Text2) c = Val(Text3)

S = 10 * a + 12 * b + 2 * c

MsgBox \您好!您本次消费共计\元\欢迎使用\End Sub

VB简单加法计算器

5 / 44