We help IT Professionals succeed at work.

Draw a needle on a speedo type control

Last Modified: 2013-12-03

I have a need to have several "speedo" style controls on my winform. I will be using a timer control to pass the current value to the control every 1/2 a second. I need the control to draw the needle in the corresponding position showing the up to date value. I also need a needle showing the maximum that the value has gone to. I dont need a scale on the control. I have a bitmap that I will use as the background.

I think the best way to do this is to create a custom control that I pass a value to. What I need is the code to create this control and to draw the current and the maximum needles.  

I will give 500 points and an A grade to the person that can supply with the full working code.

Thanks in advance
Watch Question

Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009

What kind of gauge do you want?  A full circle?  The top half of a Circle?  How big?  (i.e., 250x250)  What are the minimum and maximum values?  Are they integral values or floating point? etc.....

Can you show us an example of something you would like to model?  Try Google Images...


Thanks fo the response.

I need a half circle gauge control no bigger than 100x100. The minimum value will always be 0 but the mximum value must be variable. there will be no scale on the gauge so as long as the needle moves proportinaly with the maximum poss then thats ok. I only need something very simple.

something similar to either of the top 2 from this screenshot

Sorry I'm not too sure what you mean by integral values or floating point? The application will be showing how many watts of light are coming out of a light box over a 24hr period. Different lights in the lightbox come on at different times. SO I want to have a 24 hour cycle that the user can watch on screen. I will be using a timer to run the cycle. Every time the timer triggers I want the gauge to adjust to correspond with the amount of watts that is currentyl being outputted. I have a forumla which works this out. All I want to do is pass this figure to the gauge control and for the needle to move accordingly. The maximum value would have been set before the cycle starts.

I have quite happy with passing all of the data and making the control itself. What I need the help with is drawing the needle and making sure it is in the correct proportinal position to the maximum of the scale.

I hope that helps to clarify my requirement.  
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009
This one is on us!
(Get your first solution completely free - no credit card required)


Excellent! That is just what I need to give me the grounding to make just what I want. 500 points very well deserved!
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.