vb 在窗体上显示图形(菱形) 怎么写代码?

来源:百度知道 编辑:UC知道 时间:2024/05/05 07:09:11
编写程序,在窗体上显示各形状颜色的星花。
请附带上代码

Private Sub Form_Click()
Dim lWidth As Long
Dim lHeight As Long
Dim lLeft As Long
Dim lTop As Long
Dim iRow As Integer
Dim i As Integer
Dim iColor As Integer
Me.Font.Size = 12
lWidth = Me.TextWidth("*")
lHeight = Me.TextHeight("*")
iColor = 1
Me.Cls
Me.AutoRedraw = True
For iRow = 1 To 6
lTop = lHeight * iRow + 60
lLeft = lWidth * (6 - iRow) / 2 + 60

For i = 1 To iRow
lLeft = lLeft + lWidth
Me.CurrentY = lTop
Me.CurrentX = lLeft
iColor = iColor + 1
If iColor > 14 Then iColor = 1
Me.ForeColor = QBColor(iColor)
Print "*"
Next
Next
For iRow = 7 To 11
lTop = lHeight * iRow + 60
lLeft = lWidth * (iRow - 6) / 2 + 60