![]() |
Desktop Development »
Static & Panel Controls »
General
Intermediate
An LED Style display control and bar controlBy Jason TroitskyA control to display time, floating point numbers or integers using an LED digital-style display |
VC6, MFC, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

The CStaticCounter class simplifies the display of time and numerical
values using a digital-style counter - without using bitmaps.
The class uses Keith Rule's double-buffering
class to completely remove flicker, and it uses MoveTo/LineTo for
drawing, and therefore has no dependancies on bitmaps.
The original class was written quite a while ago now and can be found at CodeGuru. This version, however, has a lot more functionality. New features include:
CStaticCounter controls to enable you to
identify them upon trapping the WM_UPDATE_STATIC messageCStaticCounterThe class also uses static control's dimensions to calculate metrics, which means it'll draw well formed digits with minimal intervention, regardless of the control's size.
Single Click Left Mouse Button: Decreases the value by 1 Single Click Right Mouse Button: Increases the value by 1 Left Mouse Button and drag: Increases or decreases by (mouse distance*1) Right Mouse Button and drag: Increases or decreases (mouse distance*0.01) - but displays a whole number
Single Click Left Mouse Button: Decreases the value by 0.01 Single Click Right Mouse Button: Increases the value by 0.01 Left Mouse Button and drag: Increases or decreases by (mouse distance*1) Right Mouse Button and drag: Increases or decreases (mouse distance*0.01)
void Display(CString strDisplay)This function will display your string in a digital counter style, ignoring all characters except: 0 1 2 3 4 5 6 7 8 9 . :
void Display(UINT uSecs=0, UINT uMins=0, UINT uHours=0, UINT uDays=0, CString strFormat="%D:%H:%M:%S")This function enables you to simply tell the control to display, for instance, 5196 seconds by simply typing
Display(5196). The output will be displayed in D:H:M:S format unless you change the format string (last parameter) accordingly.void DisplayCurrentTime(CString strFormat = "%H:%M:%S")
| You must Sign In to use this message board. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 17 Jan 2000 Editor: Chris Maunder |
Copyright 2000 by Jason Troitsky Everything else Copyright © CodeProject, 1999-2009 Web18 | Advertise on the Code Project |