Fade Button control

Fade Button control

This article was submitted .

Here is yet another control, which uses the DIB (Device Independent Bitmap) classes I wrote some time ago.

The control slowly fades between two bitmaps when the mouse hovers over it.
It uses the same DIB classes and image filters as I used in the Skinned UI sample (see link below).

How to use it

Place a button on a dialog. Then add a member variable to your dialog implementation file...
CFadeButtonCtrl m_ctrlButton;
In the OnInitDialog() event handler, add the following lines:
LRESULT OnInitDialog(UINT /*uMsg*/, 
                     WPARAM /*wParam*/, 
                     LPARAM /*lParam*/, 
                     BOOL& /*bHandled*/)
  m_ctrlButton.SetImages(IDB_NORMAL, IDB_GLOW);
Add the following reflection macro to your main message map:
Finally add two bitmaps with identifiers IDB_NORMAL and IDB_GLOW. It's a good idea to choose images with plenty of colours.

Source Code Dependencies

Microsoft Visual C++ 6.0
Microsoft WTL 7.0 Library

See Also

Another sample with DIB controls

Download Files

DownloadSource Code and sample (44 Kb)