Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Graphical Stopwatch showing Time Elapsed
Message
De
03/02/2004 11:01:59
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
03/02/2004 10:28:37
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00873094
Message ID:
00873400
Vues:
24
>>>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
&gt;>			.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
&gt;>			.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 :).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform