Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Line x:Name="hourHand" X1="100" Y1="100" X2="100" Y2="60" Stroke="Black" StrokeThickness="4"/>
- <Line x:Name="minuteHand" X1="100" Y1="100" X2="100" Y2="40" Stroke="Black" StrokeThickness="2"/>
- private void Timer_Tick(object sender, EventArgs e)
- {
- // Update the clock hands based on the current time
- DateTime currentTime = DateTime.Now;
- double hoursAngle = (currentTime.Hour % 12 + currentTime.Minute / 60.0) * 30;
- double minutesAngle = currentTime.Minute * 6;
- // Rotate clock hands
- hourHand.RenderTransform = new RotateTransform(hoursAngle, 100, 100);
- minuteHand.RenderTransform = new RotateTransform(minutesAngle, 100, 100);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement