VB 用循环语句显示以下图案1 5 1 6 1 7 12345 8 5432112 21 1234 4321123 321 123 3211234 4321 12 2112345 54321 1 18个按钮显示8个图形在picturebox上
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/20 16:04:21
![VB 用循环语句显示以下图案1 5 1 6 1 7 12345 8 5432112 21 1234 4321123 321 123 3211234 4321 12 2112345 54321 1 18个按钮显示8个图形在picturebox上](/uploads/image/z/11639711-47-1.jpg?t=VB+%E7%94%A8%E5%BE%AA%E7%8E%AF%E8%AF%AD%E5%8F%A5%E6%98%BE%E7%A4%BA%E4%BB%A5%E4%B8%8B%E5%9B%BE%E6%A1%881+5+1+6+1+7+12345+8+5432112+21+1234+4321123+321+123+3211234+4321+12+2112345+54321+1+18%E4%B8%AA%E6%8C%89%E9%92%AE%E6%98%BE%E7%A4%BA8%E4%B8%AA%E5%9B%BE%E5%BD%A2%E5%9C%A8picturebox%E4%B8%8A)
VB 用循环语句显示以下图案1 5 1 6 1 7 12345 8 5432112 21 1234 4321123 321 123 3211234 4321 12 2112345 54321 1 18个按钮显示8个图形在picturebox上
VB 用循环语句显示以下图案
1
5 1 6 1 7 12345 8 54321
12 21 1234 4321
123 321 123 321
1234 4321 12 21
12345 54321 1 1
8个按钮显示8个图形在picturebox上
VB 用循环语句显示以下图案1 5 1 6 1 7 12345 8 5432112 21 1234 4321123 321 123 3211234 4321 12 2112345 54321 1 18个按钮显示8个图形在picturebox上
Private Sub Command1_Click()
Dim i As Integer
For i = 1 To 5
If i 5 Then
Picture1.Print Space((i - 1) * 2); String(8 - ((i - 1) * 2), "*")
Else
Picture1.Print Space(7); "*"
End If
Next
End Sub
Private Sub Command2_Click()
Dim i As Integer
For i = 1 To 5
Picture2.Print String(2 * i - 1, "*")
Next
End Sub
Private Sub Command3_Click()
Dim i As Integer
For i = 0 To 4
Picture3.Print Spc(i); String(9, "*")
Next
End Sub
Private Sub Command4_Click()
Dim i As Integer
For i = 4 To 0 Step -1
Picture4.Print Spc(i); String(9, "*")
Next
End Sub
Private Sub Command5_Click()
Dim i As Integer, j As Integer, m As String
For i = 1 To 5
m = ""
For j = 1 To i
m = m + Trim(Str(j))
Next
Picture5.Print m
Next
End Sub
Private Sub Command6_Click()
Dim i As Integer, j As Integer, m As String
For i = 1 To 5
m = ""
For j = i To 1 Step -1
m = m + Trim(Str(j))
Next
Picture6.Print m
Next
End Sub
Private Sub Command7_Click()
Dim i As Integer, j As Integer, m As String
For i = 5 To 1 Step -1
m = ""
For j = 1 To i
m = m + Trim(Str(j))
Next
Picture7.Print m
Next
End Sub
Private Sub Command8_Click()
Dim i As Integer, j As Integer, m As String
For i = 5 To 1 Step -1
m = ""
For j = i To 1 Step -1
m = m + Trim(Str(j))
Next
Picture8.Print m
Next
End Sub
完毕,望采纳.