VB金字塔图形的打印

2024-12-28 18:10:50
推荐回答(2个)
回答1:

Private Sub Command1_Click()
Open App.Path & "\picture.dat" For Output As #1
Dim N As Integer
N = 4 'A的行数
For i = 1 To 2 * N
Print #1, Tab((Abs(i - N - 0.5) * 2 + 1) / 2); String(2 * N - Abs(i - N - 0.5) * 2, IIf(i < N + 1, "A", "B"))
Next
Close
Command1.Caption = "完成"
Command1.Enabled = False
End Sub

回答2:

设开始按钮的名称为Cmd1
private sub cmd1_click()
open app.path & "/picture.dat" for output as #1

for i = 1 to 7
a =string("A",i)
print a
write #1,a
next
for i = 7 to 1
b= string("B",i)
print b
write #1,b
next
cmd1.caption = "完成"
cmd1.enabled = false
end sub