Advertisement
programusy

Untitled

Oct 9th, 2023
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <Line x:Name="hourHand" X1="100" Y1="100" X2="100" Y2="60" Stroke="Black" StrokeThickness="4"/>
  2. <Line x:Name="minuteHand" X1="100" Y1="100" X2="100" Y2="40" Stroke="Black" StrokeThickness="2"/>
  3.  
  4.  
  5. private void Timer_Tick(object sender, EventArgs e)
  6. {
  7. // Update the clock hands based on the current time
  8. DateTime currentTime = DateTime.Now;
  9. double hoursAngle = (currentTime.Hour % 12 + currentTime.Minute / 60.0) * 30;
  10. double minutesAngle = currentTime.Minute * 6;
  11.  
  12. // Rotate clock hands
  13. hourHand.RenderTransform = new RotateTransform(hoursAngle, 100, 100);
  14. minuteHand.RenderTransform = new RotateTransform(minutesAngle, 100, 100);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement