Click here to Skip to main content
6,306,412 members and growing! (18,631 online)
Email Password   helpLost your password?
Platforms, Frameworks & Libraries » WTL » General     Intermediate

A Gradient Static Control

By Ilya Solnyshkin

A Static control with a gradient
VC6, VC7, VC7.1Win2K, WinXP, Win2003, WTL, Dev
Posted:6 Oct 2003
Views:30,942
Bookmarked:16 times
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
14 votes for this article.
Popularity: 3.17 Rating: 2.77 out of 5
6 votes, 42.9%
1
1 vote, 7.1%
2
2 votes, 14.3%
3
2 votes, 14.3%
4
3 votes, 21.4%
5

Sample Image - gradientstatic.jpg

Introduction

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 CGradientStatic control to ID using the SubclassWindow method.
#include "CGradientStatic.h"


//...


class CMainDlg : public CDialogImpl<CMainDlg>
{     
    BEGIN_MSG_MAP(CMainDlg)          
       ...          
       MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)          
       REFLECT_NOTIFICATIONS()     
    END_MSG_MAP()
    ...
    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 ) );     
     m_GradientBar.SetColor(RGB(255,0,0));
     m_GradientBar.SetGradientColor(RGB(0,0,0));

     ...
}

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

Ilya Solnyshkin


Member

Occupation: Web Developer
Location: Canada Canada

Other popular WTL articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 3 of 3 (Total in Forum: 3) (Refresh)FirstPrevNext
GeneralPlagiat ?? ! PinmemberIrek Zielinski12:59 8 Oct '03  
GeneralRe: Plagiat ?? ! PinmemberGroovBird3:43 29 Nov '04  
GeneralRe: Plagiat ?? ! PinmemberIrek Zielinski21:59 29 Nov '04  

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

PermaLink | Privacy | Terms of Use
Last Updated: 6 Oct 2003
Editor: Nishant Sivakumar
Copyright 2003 by Ilya Solnyshkin
Everything else Copyright © CodeProject, 1999-2009
Web20 | Advertise on the Code Project