If Check1.Value = 1 Then
Label1.FontBold = True
Else
Label1.FontBold = False
End If
End SubPrivate Sub Check2_Click()
If Check2.Value = 1 Then
Label1.FontItalic = True
Else
Label1.FontItalic = False
End If
End Sub Private Sub Check3_Click()
If Check3.Value = 1 Then
Label1.FontUnderline = True
Else
Label1.FontUnderline = False
End If
End SubPrivate Sub Command1_Click()
Timer1.Enabled = True
End SubPrivate Sub Option1_Click()
Option1.Value = True
Label1.Font = "宋体"
End SubPrivate Sub Option2_Click()
Option2.Value = True
Label1.Font = "黑体"
End SubPrivate Sub Option3_Click()
Option3.Value = True
Label1.Font = "楷体_GB2312"
End SubPrivate Sub Option4_Click()
Option4.Value = True
Label1.FontSize = 12
End SubPrivate Sub Option5_Click()
Option5.Value = True
Label1.FontSize = 18End SubPrivate Sub Option6_Click()
Option6.Value = True
Label1.FontSize = 22
End SubPrivate Sub Option7_Click()
Timer1.Enabled = True
Timer1.Interval = 1000
End SubPrivate Sub Option8_Click()
Timer1.Enabled = True
Timer1.Interval = 500
End SubPrivate Sub Option9_Click()
Timer1.Enabled = True
Timer1.Interval = 100End SubPrivate Sub Timer1_Timer()
If Label1.Left + Label1.Width >Form1.ScaleWidth Then
Label1.Left = Form1.ScaleLeft
Else
Label1.Move Label1.Left + 30
End If
End Sub这是实验第一部分的代码和界面设计。Option Explicit
Dim i As Integer, A(0 To 59) As IntegerPrivate Sub Command1_Click()
Dim k As Integer, j As Integer, b(0 To 59) As Integer
k = 0
For j = 0 To 59
If A(j) Mod 2 = 0 Then
b(k) = A(j)Text2.Text = Text2.Text &Str(b(k)) &Chr(9)
k = k + 1
End If
Next j
End SubPrivate Sub Form_Load()
i = 0
End SubPrivate Sub Timer1_Timer()
Dim n As Integer
If i >59 Then
Timer1.Enabled = False
Exit Sub
Else
n = Int(Rnd * 101 + 100)
Randomize
End If
If i Mod 10 = 0 Then
Text1.Text = Text1.Text + vbCrLf
End If
A(i) = n
Text1.Text = Text1.Text &Str(n) &Chr(9)
i = i + 1
End Sub这是实验第二部分代码和界面设计
Private Sub Form_Click() '点击窗体运行Dim x As Integer, y As Double
x = Int(Val(InputBox("请输入x的值")))
Select Case x
Case 11 To 20
y = 4 * x - 2
Case 21 To 50
y = Sqr(23) + 12
Case Else
y = Log(x) - 3
End Select
MsgBox "y的值为" & y
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)