Click here to Skip to main content
13,598,868 members
Click here to Skip to main content
Add your own
alternative version


19 bookmarked
Posted 6 Oct 2003

A Gradient Static Control

, 6 Oct 2003
Rate this:
Please Sign up or sign in to vote.
A Static control with a gradient

Sample Image - gradientstatic.jpg


The idea was to have a small piece of code which makes it easy to create a gradient control. I saw a lot of great code, but it was not exactly what I want.  So I decided to create my own CGradientStatic-class.

Usage of CGradientStatic

To use this control in your application:

  • Design the dialog and add the Static control
  • Add the GradientStatic.h header file to your project
  • Assign a CGradientStatic to your static control.
  • In OnInitDialog(), subclass
    control to ID using the SubclassWindow method.
#include <span class="code-string">"CGradientStatic.h"</span>


class CMainDlg : public CDialogImpl<CMainDlg>
       MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)          
    LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, 
        LPARAM /*lParam*/, BOOL& /*bHandled*/);
    CGradientStatic m_GradientBar;     


LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, 
      LPARAM /*lParam*/, BOOL& /*bHandled*/) 
     m_GradientBar.SubclassWindow( ::GetDlgItem( IDC_STATIC1 ) );     



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

Ilya Solnyshkin
Web Developer
Canada Canada
No Biography provided

You may also be interested in...


Comments and Discussions

QuestionLicense Type Pin
vinothkumar.ekambaram@gmail.com11-Feb-18 19:26
membervinothkumar.ekambaram@gmail.com11-Feb-18 19:26 
GeneralPlagiat ?? ! Pin
Irek Zielinski8-Oct-03 11:59
memberIrek Zielinski8-Oct-03 11:59 
GeneralRe: Plagiat ?? ! Pin
GroovBird29-Nov-04 2:43
memberGroovBird29-Nov-04 2:43 
GeneralRe: Plagiat ?? ! Pin
Irek Zielinski29-Nov-04 20:59
memberIrek Zielinski29-Nov-04 20:59 

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 | Cookies | Terms of Use | Mobile
Web01-2016 | 2.8.180621.3 | Last Updated 7 Oct 2003
Article Copyright 2003 by Ilya Solnyshkin
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid