Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Ok, so I have a circular progress control in my Windows Form.
The circular control has a ProgressAngle property and a StartAngle property, both can be modified.

The startAngle is set to 270. The ProgressAngle must change according to the mouse position within the MouseMove event in it. ProgressAngle can reach from 0 to 360 or 0 to -360;

I have tried many ways to find the correct angle but I had no success.

Here are some approaches I have made:
C#
double dy = (point.Y - centerPoint.Y);
double dx = (point.X - centerPoint.X);

double theta = Math.Atan2(dy,dx);

double angle = (90 - ((theta * 180) / Math.PI)) % 360;

volume.ProgressAngle = Convert.ToInt32(angle);


C#
int dx = Math.Abs(x2 - x1);
int dy = Math.Abs(y2 - y1);

double angleRadians = Math.Atan2(dy, dx);

double angleDegrees = (angleRadians * 180)/Math.PI;
volume.ProgressAngle = Convert.ToInt32(angleDegrees);



I get no exceptions, no errors, the control just doesn't work properly.

Thanks in Advance - CCB
Posted
Comments
BillWoodruff 10-Nov-15 21:00pm    
What you describe does not sound like a circular progress control; it sounds like you are using the mouse to move something (indicator ?) in the control around.

First thing to check is to see if the input to the control is in Radians rather than degrees.

Do you have the source for the Control ?
ChrisCreateBoss 10-Nov-15 21:25pm    
No, when you move the mouse, let's say up, the circle progress should increase its value or in this case its ProgressAngle, if mouse goes down, the value decreases. And I found the control in VisualStudioGallery. You can see it here: https://visualstudiogallery.msdn.microsoft.com/9d2fe9ac-dea4-4551-a015-6c59500c7779

1 solution

I took a look at this Control, and its source (thanks to the JetBrains de-compiler); I'd say it's a very amateurishly coded Control; and, the author provides no read-me file, no link to source-code on GitHub or similar, no contact information.

My sense is that what you want, here, is a circular dial Control that the user can "turn" at run-time and which will raise a "value changed" Event. This Control is not a good basis for doing that in my opinion.

I suggest you experiment with the Control's 'ProgressInDegree parameter which takes a float. Using that parameter I was able to get the progress indicator (the red arc in the circle) to move, but I was not able to get stepped movement (animation).

You can leave a message on the Visual Studio Gallery page for the author, but the last message there is a few years old, and no sign of a response.

Suggest you look elsewhere for a circular .NET Control: there are some examples here on CodeProject, like: [^]
 
Share this answer
 

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