Meter Windows Control
This article is a revised version of previous article named Windows Forms Controls in C# and .NET (Analog Meter).
I have made some revisions to the Meter Control that was posted on March 16, 2005.The Article was titled "Windows Forms Controls in C# and .NET (Analog Meter)".
The Meter is a custom control that visually simulates an analog meter to display varying input values. I wanted it to be as customizable as possible so I built in several features. The Meter is elliptical and is scalable. The following is a description of the revisions that were made to the meter.
- The meter is now circular in shape rather than the inherent square shape of a control.
- Double buffered to smooth animation.
- Improved VS.net Property Browser support.
- The 'WarnTickStart' property is now determined by a value to point to, where as before it was determined by a degree to point to.
- CustNumSize -- (float) The Meter has a digital read out of the current value. This property allows for the customization of the size of the font (in pixels) when the 'UseCustNumSize' property is set to true.
- UseCustNumSize -- (bool) must be set to true for the CustNumSize to work, otherwise the numbers will be scaled proportionally to the size of the control.
- MaxDeg -- (float) The degree where the last tick mark will be located (0 is straight down).
- MinDeg -- (float) The degree where the first tick mark will be located (0 is straight down).
- ValueRange -- (float) The number of values that the Meter to monitor (0 to Range).
- NeedleVal -- (float) This is what needs to be set to change the value that the needle and digits display.
- FaceColor -- (Color) The FaceColor is the main color of the Meter.
NumColor -- (Color) This sets the color of the digital readout.
- TickColor -- (Color) This sets the color of the tick marks.
- TickWarningColor -- (Color) This sets the color of the tick marks in the "warning area".
- TickIncrement -- (float) This sets the number of values per tick mark.
- WarnTickStart -- (float) This sets the value at which the "warning area" will begin.
The included demo program attempts to illustrates the flexibility, and the elliptical shape of the meter.
A couple of possible uses of the meter are system resource monitoring, & audio signals, but the possibilities are limitless.
1. Add the control to your toolbox.
2. Drag and drop it onto your application.
3. Set it's NeedleVal property every time you want the needle to move.