创建一个按钮commmand1
复制以下代码:
Option Explicit
Private Sub Command1_Click()
Dim i As Integer, n As Integer
Dim j As Integer
For i = 1 To 7
Print Tab(20 - i);
For j = 1 To 2 * i - 1
If j = 1 Or j = 2 * i - 1 Then
Print "*";
Else
Print " ";
End If
Next
Print
Next
n = i - 2
For i = n To 1 Step -1
Print Tab(20 - i);
For j = 1 To 2 * i - 1
If j = 1 Or j = 2 * i - 1 Then
Print "*";
Else
Print " ";
End If
Next
Print
Next
End Sub