Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
how to draw an continuously varying angle in user control in C# winform?

What I have tried:

need to draw a continuously varying angle in C# winform.
I will have a Reference angle will be ,but with respect to that i need to draw the angle difference continuously and show to user.
Posted
Updated 14-Nov-18 20:00pm
Comments
ZurdoDev 14-Nov-18 15:18pm    
Where are you stuck?
[no name] 14-Nov-18 15:19pm    
Draw a circle from 0 to 360 degree.... ?

Use WPF, RotateTransform and a StoryBoard.

Storyboard with RotateTransform[^]
 
Share this answer
 
The first step is to ensure your control can draw the current angle correctly. Once this is done, you will have to instruct it to draw itself regularly.

You can use this call to get the control to paint once again:

Control.Invalidate Method (System.Windows.Forms) | Microsoft Docs[^]

You call it from a timer - or even call it from within the paint method itself to force a repaint immediately. Experiment a bit to find the best balance between performance impact and a smooth animation.

If you can't get the desired performance, you might need to consider something like WPF or even DirectX - but unless you have very strict requirements or complex rendering you are probably OK with WinForm.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900