Hi, i followed a tutorial which generates a clock graphic here is the code:
But the analogue clock shows upside down, how can i fix this
Code:
Clock
Sub DrawHand(ByVal myGraphics As Graphics, ByVal myPen As Pen, ByVal cx As Integer, ByVal cy As Integer, ByVal num As Integer, ByVal rad As Integer)
Dim x, y As Integer
x = rad * Math.Sin((num * Math.PI) / 30)
y = rad * Math.Cos((num * Math.PI) / 30)
myGraphics.DrawLine(myPen, cx, cy, cx + x, cy - y)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim cx, cy, rad As Integer
cx = 50 : cy = 50 : rad = (-40)
Dim myGraphics As System.drawing.Graphics
myGraphics = pbxClock.CreateGraphics()
myGraphics.FillEllipse(Brushes.White, cx - rad, cy - rad, rad * 2, rad * 2)
myGraphics.DrawEllipse(Pens.DarkBlue, cx - rad, cy - rad, rad * 2, rad * 2)
DrawHand(myGraphics, Pens.Blue, cx, cy, Hour(Now) * 5, rad * 0.6)
DrawHand(myGraphics, Pens.Green, cx, cy, Minute(Now), rad * 0.9)
DrawHand(myGraphics, Pens.Red, cx, cy, Second(Now), rad)
myGraphics.Dispose()
End Sub
But the analogue clock shows upside down, how can i fix this