Click here to Skip to main content
Licence 
First Posted 16 Dec 2002
Views 170,430
Bookmarked 53 times

A simple transparent CStatic-derived class

By | 16 Dec 2002 | Article
This class allows you to create transparent static controls. For instance, you can add text on a bitmap in a dialog.

Description

Sometimes, transparent static controls are very useful. For example, you have a dialog with a bitmap in it and want to add some text in the picture. If you create a static control, your text will appear on an opaque background, even if you've selected the WS_EX_TRANSPARENT style (this style is *very* buggy).

How to implement

To use the class in your application you need to do the following:

  1. Insert the .h and .cpp files into your project.
  2. Add a static control into your dialog resource.
  3. Add a member variable for that static control.
  4. Modify the variable declaration.
    Change this:
    CStatic m_Static
    To this:
    CTransparentStatic m_Static
  5. Don't forget the #include at the top of the include file:
    #include "TransparentStatic.h"

That's it. You should now have a transparent background.

Features

The following Static Styles are implemented:

  • SS_LEFT
  • SS_LEFTNOWORDWRAP
  • SS_RIGHT
  • SS_CENTER
  • SS_CENTERIMAGE (center text vertically)
  • SS_NOPREFIX
  • SS_WORDELLIPSIS
  • SS_ENDELLIPSIS
  • SS_PATHELLIPSIS

The various borders (SS_SUNKEN, WS_EX_CLIENTEDGE, ...) are also supported.

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

Zorglab

Web Developer

Belgium Belgium

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
QuestionHow to use it in VC6.0??? Pinmemberqingqingcao20:02 22 Dec '11  
QuestionWhat's the license of this article? PinmemberXueyan18:49 4 Sep '11  
GeneralGUI Bug PinmemberAin Bahadur Mor22:20 7 Oct '08  
GeneralNot Working.. Pinmemberrenjith_sree20:22 29 Jun '04  
GeneralRe: Not Working.. PinmemberJaime Stuardo3:53 21 Nov '04  
Questionwhere are the resource fiiles? Pinmembergundamchen16:22 9 Jun '04  
GeneralHelp - filckering when repeatly redraw Pinmemberlily0lin8:29 7 May '04  
GeneralRe: Help - filckering when repeatly redraw Pinmembereric feng4:33 17 May '04  
GeneralGarbled text on a redraw PinmemberAAntix4:25 12 Jan '04  
QuestionHow to change static text color? Pinmemberjameslauta13:50 11 Dec '03  
GeneralGood, How about Icon or Bitmap Pinmemberliuhoihing16:20 26 Nov '03  
GeneralSimple Enhancement Pinmemberliuhoihing17:00 26 Nov '03  
Questionwhy "ss_sunken" don't work?? Pinmembersend_ch2:04 17 Aug '03  
GeneralWM_ERASEBKGND PinmemberMarkovAlex15:08 6 Aug '03  
QuestionWhat if you need to redraw the text? PinmemberArash Salarian6:46 5 May '03  
AnswerRe: What if you need to redraw the text? Pinmemberuse_id3:29 3 Jul '03  
AnswerRe: What if you need to redraw the text? Pinmembertong_du10:03 8 Jul '03  
GeneralRe: What if you need to redraw the text? PinmemberYe Fenglei21:37 21 Jul '03  
GeneralRe: What if you need to redraw the text? Pinmemberimaudi18:48 8 Sep '03  
GeneralRe: What if you need to redraw the text? PinmemberSick@work3:29 2 Feb '04  
GeneralRe: What if you need to redraw the text? Pinmembereric feng4:30 17 May '04  
GeneralRe: What if you need to redraw the text? PinmemberK(arl)21:38 1 Dec '05  
GeneralRe: What if you need to redraw the text? PinmemberNic Wilson15:02 6 Jul '10  
GeneralRe: What if you need to redraw the text? Pinmemberwlburgess6:46 21 Oct '05  
GeneralI use it in windowsce.net,but error has happened PinmemberTony.Xu21:08 27 Mar '03  

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
Web04 | 2.5.120517.1 | Last Updated 17 Dec 2002
Article Copyright 2002 by Zorglab
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid