Dim a() As Variant
Private Sub Combo1_Click()
Label1.FontName = Combo1.Text
Label2.FontName = Combo1.Text
End Sub
Private Sub Combo2_Click()
Label1.FontSize = Val(Combo2.Text)
Label2.FontSize = Val(Combo2.Text)
End Sub
Private Sub Form_Activate()
a = Array(24, 13, 45, 37, 59, 61, 78, 96, 89, 47, 18, 65, 79, 14, 62, 85, 43, 91, 97, 42)
For i = LBound(a) To UBound(a)
Label1.Caption = Label1.Caption + CStr(a(i)) + Space(1)
If (i + 1) Mod 5 = 0 Then Label1.Caption = Label1.Caption + vbCrLf
Next i
End Sub
Private Sub Form_Load()
Dim i As Integer
Combo1.Clear
For i = 0 To Screen.FontCount - 1
Combo1.AddItem Screen.Fonts(i)
Next
Combo1.Text = "请选择字体"
For i = 8 To 20
Combo2.AddItem i
Next i
Combo2.Text = "请选择字号"
End Sub
Private Sub Option1_Click()
Label2.Caption = ""
Dim b()
b = a
For i = LBound(b) To UBound(b) - 1
For j = i + 1 To UBound(b)
If b(j) < b(i) Then
t = b(i)
b(i) = b(j)
b(j) = t
End If
Next j
Next i
For i = LBound(b) To UBound(b)
Label2.Caption = Label2.Caption + CStr(b(i)) + Space(1)
If (i + 1) Mod 5 = 0 Then Label2.Caption = Label2.Caption + vbCrLf
Next i
End Sub
Private Sub Option2_Click()
Dim b(), FindNum As Integer, Flag As Boolean
FindNum = InputBox("请输入要查找的数:", "查找")
b = a
Flag = False
For i = LBound(b) To UBound(b)
If b(i) = FindNum Then
Label2.Caption = "a(" & i + 1 & ")=" & FindNum
Flag = True
Exit For
End If
Next i
If Not Flag Then
Label2.Caption = "数组中没有" & FindNum & "这个数。"
End If
End Sub
Private Sub Option3_Click()
Label2.Caption = ""
Dim b(), Flag As Boolean, Counter As Integer
b = a
For i = LBound(b) To UBound(b)
Flag = True
For j = 2 To Sqr(b(i))
If b(i) Mod j = 0 Then
Flag = False
Exit For
End If
Next j
If Flag Then
Counter = Counter + 1
Label2.Caption = Label2.Caption + CStr(b(i)) + Space(1)
If Counter Mod 5 = 0 Then Label2.Caption = Label2.Caption + vbCrLf
End If
Next i
End Sub
我会提前帮你准备.
这个可以做。需要写设计书么?