Private Sub Form_Load() Label1.AutoSize = True Label1.BorderStyle = 1 End Sub Private Sub 数字金字塔_Click() Dim N As Integer, i As Integer, j As Integer, S As String Label1.Caption = "" Do N = Int(InputBox("")) Loop Until N > 0 And N < 10 For i = 1 To N S = String(2 * (N - i) + 1, " ") For j = 1 To i S = S & j & " " Next For k = i - 1 To 1 Step -1 S = S & k & " " Next Label1.Caption = Label1.Caption & vbCrLf & S Next End Sub 把标签换作在窗体输出即可