vb实验指导答案

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

实验一

2.

Private Sub Command1_Click() Label1.ForeColor = vbRed

End Sub

Private Sub Command2_Click() Label1.BackColor = vbBlue

End Sub

Private Sub Command3_Click() Label1.ForeColor = Form1.ForeColor Label1.BackColor = Form1.BackColor End Sub

Private Sub Command4_Click()

End

End Sub

3.

Private Sub Command1_Click()

Text1.FontSize = 30

Command1.Enabled = False Command2.Enabled = True Command3.Enabled = True

End Sub

Private Sub Command2_Click()

Text1.FontSize = 6

Command2.Enabled = False Command1.Enabled = True Command3.Enabled = True

End Sub

Private Sub Command3_Click()

Text1.FontSize = 9

Command3.Enabled = False Command1.Enabled = True Command2.Enabled = True

End Sub

4.

Private Sub Command1_Click()

a = 3.14

r = Val(Text1.Text)

Text2.Text = 2 * a * r

Text3.Text = a * r * r

End Sub

Private Sub Command2_Click()

Text1.Text = ""

Text3.Text = ""

End Sub

Private Sub Command3_Click()

End

End Sub

5.

Private Sub Command1_Click()

Label1.BorderStyle = 1

End Sub

Private Sub Command2_Click()

Label1.Left = Label1.Left + 200

Label1.Top = Label1.Top - 150

End Sub

Private Sub Command3_Click()

Label1.Visible = False

End Sub

Private Sub Command4_Click()

Label1.Visible = True

End Sub

6.

Private Sub Command1_Click()

Text2.Text = Text1.SelText

Text3.Text = Text1.SelLength

Text1.Locked = True

End Sub

Private Sub Command2_Click()

Text1.Text = ""

Text2.Text = ""

Text3.Text = ""

Text1.SetFocus

End Sub

7.

Private Sub Command1_Click()

Dim r, q, v

q = Val(Text2.Text)

r = Val(Text1.Text)

v = Val(Text3.Text)

Label5.Caption = r * 60 * 60 + q * 60 + v End Sub

Private Sub Command2_Click()

Text1.Text = ""

Text2.Text = ""

Text3.Text = ""

Text2.SetFocus

Text3.SetFocus

End Sub

Private Sub Command3_Click()

End

End Sub

Private Sub Text1_keypress(keyascii As Integer) If keyascii = 13 Then Text2.SetFocus

End Sub

Private Sub Text2_keypress(keyascii As Integer) If keyascii = 13 Then Text3.SetFocus

End Sub

8.

(1)Dim a, v, s, c

Private Sub Text1_KeyPress(KeyAscii As Integer) a = Val(Text1.Text)

If KeyAscii = 13 Then

v = a * a * a

s = 6 * a * a

c = 4 * a

Label5.Caption = v

Label6.Caption = s

Text2.Text = c

End If

End Sub

(2)Dim a, s, v, c

Private Sub Text1_LostFocus()

a = Val(Text1.Text)

c = 12 * a

v = a * a * a

s = 6 * a * a

c = Val(Text2.Text)

Label5.Caption = v

Label6.Caption = s

End Sub

(3)Dim a, v, s, c

Private Sub Text1_Change()

a = Val(Text1.Text)

v = a * a * a

s = 6 * a * a

c = 12 * a

Label5.Caption = v

相关文档
最新文档