VB题:设计一个程序可以输出九九乘法表,可以通过单选按钮改变式样(矩行、下三角、上三角),单击图片框

2025-12-14 19:48:28
推荐回答(2个)
回答1:

'一个Picture,三个Option,大小位置随意
Private Sub Form_Load()
Option1.Caption = "矩形"
Option2.Caption = "上三角"
Option3.Caption = "下三角"
Option1.Value = True
Picture1.AutoRedraw = True
Picture1.Move 120, 720, 6100, 2150
Me.Width = 6500: Me.Height = 3500
Option1.Move 240, 120, 1100, 375
Option2.Move 1540, 120, 1100, 375
Option3.Move 2840, 120, 1100, 375

End Sub

Private Sub Picture1_Click()
Dim i As Integer, j As Integer, str1 As String
Picture1.Cls
For i = 1 To 9
For j = 1 To 9
If Option1.Value = True Then
str1 = i & "*" & j & "=" & i * j & Space(3 - Len(CStr(i * j)))
ElseIf Option2.Value = True Then
If i <= j Then
str1 = i & "*" & j & "=" & i * j & Space(3 - Len(CStr(i * j)))
Else
str1 = Space(7)
End If
Else
If i >= j Then
str1 = i & "*" & j & "=" & i * j & Space(3 - Len(CStr(i * j)))
Else
Exit For
End If
End If
Picture1.Print str1;
Next j
Picture1.Print
Next i
End Sub

回答2:

什么 叫单击图片框
这个很简单的
怎么都行
用一个循环用解决了
然后换下排列方式就行了 先写好也行 反正就是循环的问题了