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/11/15 06:19:57
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
完毕,