VB随机画圆

VB随机画圆,第1张

Private Sub Form_Click()

Randomize

Cls

Dim MaxX As Long

Dim MaxY As Long

MaxX = Form1ScaleWidth

MaxY = Form1ScaleHeight

For I = 1 To 50

x = Int(Rnd (MaxX - 500))

y = Int(Rnd (MaxY - 500))

Form1Circle (x, y), Int(Rnd 500) + 1, RGB(Int(Rnd 256), Int(Rnd 256), Int(Rnd 256))

Next

End Sub

Private Sub Form_Load()

Form1BackColor = vbBlack

End Sub

下边是个实例,放一个text,一个按钮,text里输入几个就画几个

private

sub

command2_click()

dim

i

as

integer

for

i

=

1

to

val(text2text)

form3picture1circle

(120,

260),

i

10,

vbred

'在左边为120260的位置为圆心,i10的数量为半径画个圆

next

form3picture1refresh

end

sub

你说的意思是画实心圆,我给你一个示例的代码,如下:

Dim i As Integer, l As Integer

Dim r As Boolean

Private Sub Form_Load()

Form1Scale (-200, 200)-(200, -200)

l = 1

i = 1

r = False

End Sub

Private Sub Timer1_Timer()

DoEvents

If r = False Then

Timer1Interval = i

i = i + l

Form1Cls

Form1FillStyle = 0

Form1FillColor = vbRed

Circle (0, 0), i, vbBlue

If i >= 200 Then

    r = True

End If

ElseIf r = True Then

    Timer1Interval = i

    i = i - 1

    Form1Cls

    Form1FillStyle = 0

    Form1FillColor = vbBlue

    Circle (0, 0), i, vbBlue

    If i <= 1 Then

         r = False

    End If

End If

End Sub

以上就是关于VB随机画圆全部的内容,包括:VB随机画圆、vb中画圆的代码怎么写啊、VB用circle画圆的命令等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/9458645.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-28
下一篇 2023-04-28

发表评论

登录后才能评论

评论列表(0条)

保存