Click here to Skip to main content
6,595,854 members and growing! (17,773 online)
Email Password   helpLost your password?
Desktop Development » Static & Panel Controls » General     Intermediate

CLEDScreen class - LED digital screen with transparency

By olden69

A CStatic derived digital LED screen with transparency. Based on "CStaticTime class" of Jason Hattingh.
VC6, VC7, VC7.1Win2K, WinXP, MFC, VS.NET2003, DBA, Dev
Posted:12 Jan 2005
Updated:25 Jan 2005
Views:48,451
Bookmarked:41 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
8 votes for this article.
Popularity: 3.76 Rating: 4.17 out of 5

1

2
2 votes, 25.0%
3
2 votes, 25.0%
4
4 votes, 50.0%
5

Sample Image - LEDScreen.gif

Introduction

Firstly, excuse me for my bad English.

I long searched for such a class which would allow me to emulate the beautiful digital screen in my program. Class CStaticTime (author Jason Hattingh, An LED time and value display control) appeared better than others. But in this class, there was no opportunity to set a transparency and there were not many functions necessary to me. Therefore, I have considerably altered the class CStaticTime, and the new class CLEDScreen has only a few similarities with the original.

Idea

As for most simple cases, realization of a transparency for me was the use of the function TransparentBlt(). I have refused drawing directly at a window and have applied drawing in memory ("background canvas").

At initialization of a class in memory, "the storehouse of ready symbols" (symbDC) is created and also "background canvas" (backDC). During change of contents of the LEDScreen, the class takes from symbDC a ready symbol necessary and transfers it to backDC. When it is necessary to update a window, a class takes the contents of backDC and transfers it to a window with TransparentBlt().

How To Use

Using the class is very simple.

  1. Create project.
  2. Link library msimg32.lib to project.
  3. Add LEDScreen source files to project.
  4. Place on a dialog any bitmap image (picture static). This is optional.
  5. Place on a dialog (owner bitmap if exists) CStatic. With ClassWizard, create variable m_screen for this CStatic.
  6. In your dialog declaration, rename CStatic m_screen to CLEDScreen m_screen. Like this:
    // MyDlg.h
    
    class CMyDlg : public CDialog
    {
     public:
     ...
     // Dialog Data
    
     //{{AFX_DATA(CMyDlg)
    
     enum { IDD = IDD_MY_DLG };
     CLEDScreen m_screen;
     ...
     //}}AFX_DATA
    
     ...
    }
  7. Add to function OnInitDialog() a code of initialization of an object m_screen, like this:
    // MyDlg.cpp
    
     BOOL CMyDlg::OnInitDialog()
     {
      ...
      m_screen.SetBackWnd(&m_stback); //CStatic m_stback (picture)
    
    
      m_screen.SetColourForeGround(RGB(0,0,0));
      m_screen.SetColourFaded(RGB(55,136,230));
    
      m_screen.SetRightAlignement();
      m_screen.SetDrawTransparent(true);
      m_screen.SetDrawFaded(true);
      m_screen.SetSymbolParams(0, 5, 0, 2);
      ...
    }
  8. Use functions CLEDScreen::Append(CString str), etc.:
        CLEDScreen::Append(CString str);
        CLEDScreen::Backspace();
        CLEDScreen::Clear();
        CLEDScreen::StepBack(); //scrolling
    
        CLEDScreen::StepForward(); //scrolling

To Do

  • Own bitmap instead of separate CStatic for background picture.

History

  • Version 0.1 (2005-01-10)
    • First realization.
  • Version 0.2 (2005-01-19)
    • right alignment is added.
    • drawing procedures are corrected.
  • Version 0.3 (2005-01-20)
    • scrolling of long contents is added
    • blinking is reduced

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

olden69


Member

Occupation: Web Developer
Location: Ukraine Ukraine

Other popular Static & Panel Controls articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 11 of 11 (Total in Forum: 11) (Refresh)FirstPrevNext
GeneralCant get updated draw cycles in CFormView and VS2008? Pinmemberdougwilliams12:32 28 Jun '09  
GeneralLink library Pinmemberweehau4:44 30 Nov '06  
GeneralRe: Link library Pinmembertoxcct4:51 30 Nov '06  
Generalwere is the demo !? Pinmembertoxcct4:57 19 Jan '05  
GeneralRe: were is the demo !? Pinmemberolden695:23 19 Jan '05  
GeneralRe: were is the demo !? Pinmembertoxcct7:36 19 Jan '05  
GeneralRe: were is the demo !? Pinmemberolden690:54 20 Jan '05  
GeneralRe: were is the demo !? Pinmembertoxcct3:49 20 Jan '05  
Generaltoo late :( PinmemberBamaco212:49 13 Jan '05  
GeneralRe: too late :( Pinmemberyingyuheng19:14 13 Jan '05  
GeneralRe: too late :( Pinmemberolden6922:56 13 Jan '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 25 Jan 2005
Editor: Smitha Vijayan
Copyright 2005 by olden69
Everything else Copyright © CodeProject, 1999-2009
Web21 | Advertise on the Code Project