Click here to Skip to main content
Click here to Skip to main content

XColorStatic - a colorizing static control

By , 16 Oct 2003
 

Introduction

XColorStatic is a general-purpose control to allow nice text display on a dialog. The demo shows you the kinds of text and icon display that are possible:

screenshot

XColorStatic API

Here is the complete list of CXColorStatic methods:

    void SetBackgroundColor(COLORREF rgb, BOOL bRedraw = TRUE);
    void SetTextColor(COLORREF rgb, BOOL bRedraw = TRUE);
    void SetBold(BOOL bFlag, BOOL bRedraw = TRUE);
    void SetFont(LPCTSTR lpszFaceName, int nPointSize, BOOL bRedraw = TRUE);
    void SetFont(LOGFONT *pLogFont, BOOL bRedraw = TRUE);
    void SetFont(CFont *pFont, BOOL bRedraw = TRUE);
    void SetIcon(HICON hIcon, BOOL bRedraw = TRUE);
    void SetMargins(int x, int y) { m_nXMargin = x; m_nYMargin = y; }

How To Use

To integrate XColorStatic into your app, you first need to add the following files to your project:

  • XColorStatic.cpp
  • XColorStatic.h
  • FontSize.cpp
  • FontSize.h

Then use the resource editor to add a static control to your dialog, and use Class Wizard to attach a member variable to that control. Note that when adding the static control, you must name it something other than IDC_STATIC.

Next, include the header file XColorStatic.h in the dialog's header file. Then replace the CStatic definition with CXColorStatic. Now you are ready to start using XColorStatic.

Usage

This software is released into the public domain. You are free to use it in any way you like. If you modify it or extend it, please to consider posting new code here for everyone to share. This software is provided "as is" with no expressed or implied warranty. I accept no liability for any damage or loss of business that this software may cause.

Revision History

Version 1.0 - 2003 October 17

  • Initial public release.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Hans Dietrich
Software Developer (Senior) Hans Dietrich Software
United States United States
Member
I attended St. Michael's College of the University of Toronto, with the intention of becoming a priest. A friend in the University's Computer Science Department got me interested in programming, and I have been hooked ever since.
 
Recently, I have moved to Los Angeles where I am doing consulting and development work.
 
For consulting and custom software development, please see www.hdsoft.org.






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

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralScrollbar Improvementmemberdarktrooper17 Jun '06 - 5:41 
GeneralFull Transparent Backgroundmemberwlburgess19 Oct '05 - 11:54 
GeneralRe: Full Transparent BackgroundmemberLeeJ.C.23 Oct '05 - 21:36 
GeneralRe: Full Transparent Backgroundmembercaliff_usa18 Jan '07 - 4:53 
GeneralNot displaying tabs correctly.memberDavid Fleming1 Sep '05 - 23:50 
JokeRe: Not displaying tabs correctly.memberDavid Fleming2 Sep '05 - 12:19 
GeneralCode to add Vertical Scroll Bars to this Controlmemberkbomb98728 May '05 - 8:01 
QuestionIs It A BUG ??memberrenjith_sree1 Jul '04 - 19:31 
AnswerRe: Is It A BUG ??memberSean Moss-Pultz16 Jul '04 - 1:03 
GeneralRe: Is It A BUG ??memberrenjith_sree16 Jul '04 - 1:29 
GeneralThat's wrong!memberSB200313 Nov '10 - 9:42 
GeneralDebug assertion at non-modal dialogsmemberfraenky6 Apr '04 - 21:59 
GeneralRe: Debug assertion at non-modal dialogsmemberHans Dietrich7 Apr '04 - 0:29 
GeneralRe: Debug assertion at non-modal dialogsmemberHans Dietrich7 Apr '04 - 17:16 
GeneralRe: Debug assertion at non-modal dialogsmemberGray Dragon6 May '04 - 11:01 
GeneralRe: Debug assertion at non-modal dialogsmemberHans Dietrich6 May '04 - 11:38 
GeneralRe: Debug assertion at non-modal dialogsmemberGray Dragon6 May '04 - 18:35 
GeneralRe: Debug assertion at non-modal dialogsmemberGray Dragon6 May '04 - 18:58 
GeneralRe: Debug assertion at non-modal dialogsmemberwikiguyjd26 Jan '07 - 10:32 
QuestionBug?memberHockey27 Nov '03 - 12:38 
AnswerRe: Bug?memberHans Dietrich28 Nov '03 - 0:37 
GeneralDebug Assertion Failedmemberandrewgs7327 Nov '03 - 4:12 
GeneralRe: Debug Assertion FailedmemberHans Dietrich27 Nov '03 - 9:53 
GeneralRe: Debug Assertion Failedmemberandrewgs7328 Nov '03 - 14:09 
GeneralNice But........memberAtif Mushtaq17 Oct '03 - 20:41 

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

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 17 Oct 2003
Article Copyright 2003 by Hans Dietrich
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid