Dim s As String
s = InputBox("请输入打印的字符:", , "#")
PrintShape 8, s
End Sub
Sub PrintShape(ByVal k As Integer, ByVal c As String)
Dim i, j As Integer, s As String
c = Chr(Asc(c))
For i = 0 To k
s = Space(i)
For j = 0 To 8
s = s &c
Next j
Me.Print s
Next i
End Sub
一、Private Sub Form_Click()
show
Dim m, n, i, j As Integer
m = 4 :n = 7
For i = 1 To m
For j = 1 To m - i + 1
Print " "
Next j
For j = 1 To n
Print "*"
Next j
Next i
For i = 1 To m
For j = 1 To m - i + 1
Print " "
Next j
For j = 1 To 2 * i - 1
Print "*"
Next j
Next i
For i = 1 To m
For j = 1 To i
Print " "
Next j
For j = 1 To 2 * m - 2 * i + 1
Print "*"
Next j
Next i
End Sub
二、Sub Command1_Click()
Dim i As Integer
For i = 1 To 11 Step 2
For m = 11 To i Step -1
Debug.Print "*"
Next
Print Chr(10) &Space(1 + i \ 2)
Next
End Sub
扩展资料:
在VB中,注释有2种方式。
1、以Rem关键字开头,并且Rem关键字与注释内容之间要加一个空格。注释可以是单独的一行,也可以写在其他语句行的后面。如果在其他语句行后使用Rem关键字,则必须使用冒号(:)与语句隔开。
2、使用一个撇号(')来代替Rem关键字。若使用撇号,则在其他语句行使用时不必加冒号。
特征衡量
在 Visual Basic 中,可通过属性、方法和事件来说明和衡量一个对象的特征。
参考资料来源:百度百科-Visual Basic
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)