Click here to Skip to main content
13,005,192 members (62,547 online)
Click here to Skip to main content
Add your own
alternative version


98 bookmarked
Posted 14 Mar 2007

Digital Meter Control

, 12 Jul 2007
Rate this:
Please Sign up or sign in to vote.
A digital meter control of virtual instruments

Screenshot - digitalcontrol.png


This article explains how to add a digital meter control to your dialog-based application. This digital meter control is derived from CStatic. You can customize the digital meter as you require.

Using the code

Steps for adding the digital meter control to your application:

  1. Copy the files DigitalControl.h and DigitalControl.cpp to your project directory and add them to your project.
  2. Place a Static Control to your dialog from the Control ToolBox.
  3. Using ClassWizard, add a member variable -- such as m_meter for the Static Control -- to your dialog class. Make sure that it is a control variable.
  4. In your dialog class header file, add this line on top of your class definition:
  5. Replace the following line in your dialog class header file...
    CStatic m_meter;
    ...with this line:
    CDigitalControl m_meter;

That's all. The digital meter control is now in your application. Just execute the program to view it.

Member functions

Following are the member functions that can be used to change the digital meter control settings:

void setType(int t); 
//Set the type of the meter. 0=Horiz. 1=Vert. 
void reDraw(); 
//Redraw the meter 
void setLimit(double min,double max); 
//Set the range of the meter 
void setValue(double v); 
//Set the dispaly value of the meter. 
double getValue(); 
//Get the display value of the meter 
void setBackgroundColor(int c1,int c2,int c3); 
//Set the background of the meter. 
//c1=Fill color. c2=First Border color. c3=Second Border color. 
void setGradientColor(int c1,int c2); 
//Set the gradient bar color. c1=First gradient color.. 
//c2=Second gradient color.. 
void setScaleColor(int c1,int c2); 
//Set the scale color. c1=Trangle color.. c2=Scale line color.. 
void setTextColor(int c1); 
//Set the text color. c1=Text color.


  • 14 March, 2007 -- Original version posted
  • 12 July, 2007 -- Article edited and posted to the main article base


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

United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralTranslated to C# Pin
varnk20-Oct-08 3:34
membervarnk20-Oct-08 3:34 
GeneralRe: Translated to C# Pin
Luca_v7411-Oct-11 4:00
memberLuca_v7411-Oct-11 4:00 
GeneralRe: Translated to C# Pin
varnk11-Oct-11 4:23
membervarnk11-Oct-11 4:23 
GeneralRe: Translated to C# Pin
lanmanck19-Sep-15 16:25
memberlanmanck19-Sep-15 16:25 
GeneralNice Control Pin
Paul Conrad14-Jul-07 8:18
memberPaul Conrad14-Jul-07 8:18 
Generalnegative values Pin
del Fuego23-Mar-07 8:29
memberdel Fuego23-Mar-07 8:29 
GeneralNice looking control..thanks! Pin
CodeHead19-Mar-07 3:18
memberCodeHead19-Mar-07 3:18 
Generalpublic data members Pin
toxcct15-Mar-07 23:18
mvptoxcct15-Mar-07 23:18 
GeneralRe: public data members Pin
Lingsong16-Mar-07 2:40
memberLingsong16-Mar-07 2:40 
GeneralRe: public data members Pin
toxcct16-Mar-07 2:42
mvptoxcct16-Mar-07 2:42 
GeneralGood One Pin
dharam14-Mar-07 20:18
memberdharam14-Mar-07 20:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 | Terms of Use | Mobile
Web02 | 2.8.170627.1 | Last Updated 12 Jul 2007
Article Copyright 2007 by Lingsong
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid