I'm attempting to create an analog clock with the use of a picturebox, a few shape controls, and a few line controls and am having dificulties coming up with a proper algorithm to calculate the x-y coordinates for the placement of the X1 and Y1 position of my line controls. I have the X2 and Y2 coords set to the center of the form like this:
CODE
Min.X2 = Me.Width / 2
Min.Y2 = Me.Height / 2
Sec.X2 = Me.Width / 2
Sec.Y2 = Me.Height / 2
Hrs.X2 = Me.Width / 2
Hrs.Y2 = Me.Height / 2
I could just look for the coord in the box and assign them, but I want the form to scale.
I'm looking for something so that I can set the point and move the x1 and y1 position of the hands(lines) to the next tick without too much code, but I am unfortunately not quite smart enough to figure it out. I'm going to tie it to a timer control (obviously).
I have my major time markers placed like this:
CODE
Tm(0).Left = (Sha.Width / 2) - Tm(0).Width / 2
Tm(3).Top = (Sha.Height / 2) - Tm(0).Height / 2
Tm(3).Left = (Sha.Width) - Tm(0).Width
Tm(9).Left = Sha.Left
Tm(9).Top = (Sha.Height / 2) - Tm(0).Height / 2
Tm(6).Top = Sha.Height - Tm(0).Height
Tm(6).Left = (Sha.Width / 2) - Tm(0).Width / 2
Tm(1).Top = Sha.Height * (1 / 16)
Tm(1).Left = (Sha.Width * (3 / 4)) - Tm(0).Width
Tm(11).Top = Sha.Height * (1 / 16)
Tm(11).Left = (Sha.Width * (1 / 4))
Tm(5).Top = Sha.Height * (15 / 16) - Tm(0).Height
Tm(5).Left = (Sha.Width * (3 / 4)) - Tm(0).Width
Tm(7).Top = Sha.Height * (15 / 16) - Tm(0).Height
Tm(7).Left = (Sha.Width * (1 / 4))
Tm(10).Top = Sha.Height * (1 / 4)
Tm(10).Left = (Sha.Width * (1 / 16))
Tm(8).Top = Sha.Height * (3 / 4) - Tm(0).Height
Tm(8).Left = (Sha.Width * (1 / 16))
Tm(2).Top = Sha.Height * (1 / 4)
Tm(2).Left = (Sha.Width * (15 / 16)) - Tm(0).Width
Tm(4).Top = Sha.Height * (3 / 4) - Tm(0).Height
Tm(4).Left = (Sha.Width * (15 / 16)) - Tm(0).Width
And have them scaling with the form like this:
CODE
For i = 0 To 11
Tm(i).Height = Pic.Width * 0.03
Tm(i).Width = Pic.Height * 0.03
Next i
I have all of this linked to the resize event.
I know there is a clock in the snippets, but that is not quite what I want to do here.
If anyone can wade through my convoluted post here and give me some suggestions or atleast point me in the right direction, I would be greatly appreciative.