VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Program that makes circles randomly all over the form in many colors.

by Matt Johnson (5 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 12th October 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Program that makes circles randomly all over the form in many colors.

API Declarations


Dim Color As String
Dim Num As Variant
Dim Num2 As Integer
Dim i
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


Rate Program that makes circles randomly all over the form in many colors.



Select Case Combo1.Text
 Case Is = "Random"
  Color = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
 Case Is = "Blue"
  Color = vbBlue
 Case Is = "Green"
  Color = vbGreen
 Case Is = "Red"
  Color = vbRed
 Case Is = "White"
  Color = vbWhite
 Case Is = "Yellow"
  Color = vbYellow
End Select
End Sub

Private Sub Command1_Click()
If Combo1.Text = "Random" Then
 Color = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
ElseIf Combo1.Text = "MultiColor" Then
 Num2 = Text2
 Num = Num + Num2
 Form1.Caption = Num & " Circles"
 For i = 1 To Text2
  FillColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
  FillStyle = 0
  Circle (Int(Rnd * 17970), Int(Rnd * 11985)), Int(Rnd * Text1)
 Next i
GoTo Start
End If

Num2 = Text2
Num = Num + Num2
Form1.Caption = Num & " Circles"
For i = 1 To Text2
 FillColor = Color
 FillStyle = 0
 Circle (Int(Rnd * 17970), Int(Rnd * 11985)), Int(Rnd * Text1)
Next i
Start:
End Sub

Private Sub Command2_Click()
Num = 0
Form1.Caption = Num & " Circles"
Form1.Cls
End Sub

Private Sub Form_Load()
Combo1.AddItem "MultiColor"
Combo1.AddItem "Random"
Combo1.AddItem "Red"
Combo1.AddItem "Blue"
Combo1.AddItem "Green"
Combo1.AddItem "White"
Combo1.AddItem "Yellow"
End Sub


Download this snippet    Add to My Saved Code

Program that makes circles randomly all over the form in many colors. Comments

No comments have been posted about Program that makes circles randomly all over the form in many colors.. Why not be the first to post a comment about Program that makes circles randomly all over the form in many colors..

Post your comment

Subject:
Message:
0/1000 characters