Hello i create 1 circle in the center and want 4 circles to rotate
around it. butt they seam to have amind off there one.
this is the code sofare:
Imports
System.Drawing.Drawing2D
Public
Class Form1 Friend WithEvents Timer1 As Timer Friend WithEvents Button1 As Button Friend WithEvents Button2 As Button' -- Red Circle --
Private Redangle As Single = 0 Private Reddelta As Single = 1' -- Yellow Circle --
Private Yellowangle As Single = 0 Private Yellowdelta As Single = 2' -- Blue Circle --
Private Blueangle As Single = 0 Private Bluedelta As Single = 3' -- Green Circle --
Private Greenangle As Single = 0 Private Greendelta As Single = 4Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
InitializeComponent()
Me.Timer1 = New Timer
Me.Button1 = New Button
Me.Button2 = New Button
' de instellingen van Form 1.
Me.Timer1.Enabled = False Me.WindowState = FormWindowState.Maximized Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None Me.BackColor = Color.Black Me.DoubleBuffered = True Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.Button2)
' de instellingen van Button 1.
Me.Button1.Size = New Size(100, 30) Me.Button1.UseVisualStyleBackColor = True Me.Button1.Location = New Point(0, 0) Me.Button1.Text = "Start."
' de instellingen van Button 2.
Me.Button2.Size = New Size(100, 30) Me.Button2.UseVisualStyleBackColor = True Me.Button2.Location = New Point(100, 0) Me.Button2.Text = "Exit." End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
e.Graphics.TranslateTransform(Me.ClientRectangle.Width / 2, Me.ClientRectangle.Height / 2)
' Create a 5 different pens.
Dim WhitePen As New Pen(Color.White, 2) Dim RedPen As New Pen(Color.Red, 2) Dim YellowPen As New Pen(Color.Yellow, 2) Dim BluePen As New Pen(Color.Blue, 2) Dim GreenPen As New Pen(Color.Green, 2)
' Create rotating point.
Dim RPoint As New Point(650.0, 450.0)
' Create location and size of Center ellipse.
e.Graphics.DrawEllipse(WhitePen, -50, -50, 100, 100)
e.Graphics.FillEllipse(Brushes.White, -50, -50, 100, 100)
' Create the rotating Circles.
e.Graphics.RotateTransform(Redangle)
e.Graphics.TranslateTransform(50, 0)
e.Graphics.DrawEllipse(RedPen, 50, 50, 50, 50)
e.Graphics.RotateTransform(Yellowangle)
e.Graphics.TranslateTransform(150, 0)
e.Graphics.DrawEllipse(YellowPen, 50, 50, 50, 50)
e.Graphics.RotateTransform(Blueangle)
e.Graphics.TranslateTransform(175, 0)
e.Graphics.DrawEllipse(BluePen, 50, 50, 50, 50)
e.Graphics.RotateTransform(Greenangle)
e.Graphics.TranslateTransform(200, 0)
e.Graphics.DrawEllipse(GreenPen, 50, 50, 50, 50)
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled =
True End SubPrivate Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled =
False EndEnd Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick Me.Redangle += Me.Reddelta If Redangle > 360 Then
Redangle -= 360
End IfMe.Yellowangle += Me.Yellowdelta
If Yellowangle > 360 Then
Yellowangle -= 360
End IfMe.Blueangle += Me.Bluedelta
If Blueangle > 360 Then
Blueangle -= 360
End IfMe.Greenangle += Me.Greendelta
If Greenangle > 360 Then
Greenangle -= 360
End IfInvalidate()
End Sub
End
Class
All i want is that they all rotate around the White Circle
Any Suggestions are welcom
thanks
Nightblade.