ARTICLE

Revised Gauge Custom Control in C#

Posted by Lance Drolet Articles | Custom Controls C# June 10, 2005
This is an enhanced version of the custom guage. Enclosed are the source code for the control, and the test program.
Reader Level:
Download Files:
 

This is an enhanced version of the custom gauge I submitted earlier this year. The improvements are as follows:

  • Two events have been added to indicate when the needle enters and leaves the red zone.
  • Categories and descriptions have been added to the Red Zone, Text Color, and Range attributes.

Enclosed are the source code for the control, and the test program.

The control is a round meter with the following parameters:

  • Range: The range represented (default: 100).
  • Red Zone: The area of the meter where the tick marks are drawn in the
  • Red Zone Color (default: 60).
  • Red Zone Color: color of the red zone (default: Red).
  • Text Color: Color for the rest of the tick marks and text (default: Lime).
  • Needle Color: color of the needle (default: orange).
  • Deflection: Deflection of the needle from zero (default: 0).

The one custom event the meter raises is called DeflectionChanged for obvious reasons.

The only shape available is round, and the size is determined by client rectangle height, or width (whichever is shorter).

IdGuage.gif

COMMENT USING