VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Draw a circle filled with multiple random color using line.

by Refly (1 Submission)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 26th May 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Draw a circle filled with multiple random color using line.

API Declarations



Dim red As Integer
Dim green As Integer
Dim blue As Integer
Dim x As Integer
Dim y As Integer
Dim xCenter As Integer
Dim yCenter As Integer
Dim angle As Integer

Rate Draw a circle filled with multiple random color using line.



    Timer1.Interval = 1
    Timer1.Enabled = True
    
    Me.BackColor = vbBlack
    
    Me.Width = 3000
    Me.Height = 4000
    
    xCenter = Me.Width / 2
    yCenter = Me.Width / 2
End Sub

Private Sub Timer1_Timer()
    Randomize
    
    x = xCenter + (Sin(angle) * 1000)
    y = yCenter - (Cos(angle) * 1000)
    
    red = Int(Rnd * 255)
    green = Int(Rnd * 255)
    blue = Int(Rnd * 255)
    
    Line (xCenter, yCenter)-(x, y), RGB(red, green, blue)
    
    angle = angle + 1
    
    If angle >= 360 Then angle = 0
End Sub

Download this snippet    Add to My Saved Code

Draw a circle filled with multiple random color using line. Comments

No comments have been posted about Draw a circle filled with multiple random color using line.. Why not be the first to post a comment about Draw a circle filled with multiple random color using line..

Post your comment

Subject:
Message:
0/1000 characters