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.SubclassWindow(GetDlgItem(IDC_BUTTON1));
m_ctrlButton.SetImages(IDB_NORMAL, IDB_GLOW);
...
}
Add the following reflection macro to your main message map:
BEGIN_MSG_MAP(CMainDlg)
...
REFLECT_NOTIFICATIONS()
END_MSG_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.0Microsoft WTL 7.0 Library
See Also
Another sample with DIB controlsDownload Files
![]() | Source Code and sample (44 Kb) |