>>>Is there a way to show a circle with a sweeping second hand which changes second-dots to red as it passes by? The circle and changing dots I think I can handle, but how to display the sweeping second hand has got me stumped. Thanks!
>>
>>It's a little tricky - because the Line object require the coordinates set in a special manner. You basically need two points, one (x0, y0) being the center of your clock, and the other (x1, y1) being the point on the circle. So, if R is the radius in pixels, and x0, y0 are pre-set:
>>
lnAngle=(15-nSecs)/30*pi()
>>x1=x0+cos(lnAngle)*R
>>y1=y0+sin(lnAngle)*R
>>With Thisform.line1
>> Do Case
>> Case x0<=x1 And y0>=y1
>> .Left=x0
>> .Width=Cos(lnAngle)*R
>> .Top=y1
>> .Height=Sin(lnAngle)*R
>> .LineSlant="/"
>> Case x0<=x1 And y0<y1
>> .Left=x0
>> .Width=Cos(lnAngle)*R
>> .Top=y0
>> .Height=-Sin(lnAngle)*R
>> .LineSlant="\"
>> Case x0>x1 And y0>=y1
>> .Left=x1
>> .Width=-Cos(lnAngle)*R
>> .Top=y1
>> .Height=Sin(lnAngle)*R
>> .LineSlant="\"
>> Case x0>x1 And y0<y1
>> .Left=x1
>> .Width=-Cos(lnAngle)*R
>> .Top=y0
>> .Height=-Sin(lnAngle)*R
>> .LineSlant="/"
>> Endcase
>>
>>Endwith
>>
>
>Not sure I understand this line:
>
>
>lnAngle=(15-Secs)/30*PI()
>
>
>Why the 15 and 30 values?
The regular sin() and Cos() functions expect angle measured in radians, in positive direction (clockwise is negative), starting off x-axis. So I had to recalculate the angle - 15 seconds is a right angle (we're starting the stopwatch off y-axis, not x), and 30 seconds is a 180 degree angle, which we need to scale with Pi. So, 15-nSecs is our angle in seconds; divided by 30 it gives us the same angle divided by 180; multiplying this with Pi gives us actual angle in Cartesian coordinates, expressed in radians.
The additional complication is that our on-screen coordinates have a negative direction of the y-axis (zero on top, positive numbers below)... made this a little more fun to do :).