Click here to Skip to main content
Licence 
First Posted 31 Mar 2005
Views 31,575
Bookmarked 23 times

TomOMeter

By | 25 May 2005 | Article
A meter control.

Sample Image

Introduction

This control allows the user to display values using a meter style reminiscent of the classic audio dB meters. It provides a pleasant visual representation of values between two user assignable values. In addition, the user may specify the range of a "red zone" to indicate high levels.

Background

TomOMeter is a custom Windows control library made using .NET and C#. It utilizes the rotation of Matrix objects to draw "circular" things.

Using the code

Upon adding the TomOMeter to your form, you will probably want to change some of its properties, notably:

  • End_Value: specifies maximum value of meter.
  • Start_Value: specifies starting value of meter.
  • Hash_Mark_Color: specifies color of non-"red zone" graduations.
  • Hash_Mark_Width: specifies width of all graduations.
  • Label: specifies top level (big) label.
  • Needle_Color: specifies needle color.
  • Number_Font: specifies font to be used for numbers.
  • Red_Zone: specifies value at which graduations will be drawn in "Red Zone" color.
  • Red_Zone_Color: specifies which color to use for "Red Zone".
  • Text_Color: specifies color of numbers and labels.
  • Units: specifies units (small) label.

The control is resizable, but care must be taken to avoid clipping the display. When the value of what you are measuring changes, simply set the TomOMeter's Deflection property to this new value.

For example, in my demonstration program, I want to change the needle's deflection when the value of the TrackBar changes. I do this in the main form's trackBar1.ValueChanged event handler:

private void trackBar1_ValueChanged(object sender, System.EventArgs e) 
{
    this.userControl11.Deflection = this.trackBar1.Value;
}

Points of Interest

Sadly, this control does not work well for smaller values. As there are only 10 graduations on the control, and I am rounding values to the nearest whole number, ranges less than 10 or not multiples of 10 for relatively small values produce some rather undesirable results.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

yob25



United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralRebuild of control PinmemberArith0n16:13 31 Dec '05  
GeneralRe: Rebuild of control Pinmembervaibhav_patel3:38 5 Mar '07  
GeneralRe: Rebuild of control PinmemberMountazar Abou Chrouche5:00 20 Jul '07  
GeneralRe: Rebuild of control PinmemberDieter688:06 21 Jan '09  
QuestionRe: Rebuild of control PinmemberHorscht200511:14 14 Apr '11  
GeneralAnitAlias PinmemberEinar Kvandahl5:22 20 Sep '05  
GeneralFlickering PinmemberRobert M. Bouwens8:19 1 Apr '05  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 26 May 2005
Article Copyright 2005 by yob25
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid