Click here to Skip to main content
11,929,675 members (54,872 online)
Click here to Skip to main content
Add your own
alternative version


44 bookmarked

A button with rollover behavior using C++

, 7 Jan 2003
Rate this:
Please Sign up or sign in to vote.
This class provides a button with rollover behavior
<!-- Article image -->

Sample Image - demo.jpg

Introduction<!-- Add the rest of your HTML here -->

CRolloverButton is a CButton derived class. It provides a button with rollover
behavior known from many webpages. The bitmaps must consist of three pictures
for the different states (using the following order normal, rollover, disabled) of the

Usage of CRolloverButton

  • In you resource editor create a button (do not set the 'owner draw' property).
  • Use classwizard to create a CButton object in your dialog.
  • Include the "rolloverbutton.h" file in your dialog class file.
  • Rename the CButton object type to CRolloverButton.
  • Call the SetBitmaps function in order to assign your bitmap to the new button


CRolloverButton::SetBitmaps( UINT nID, int nWidth, int nHeight, COLORREF crTransparentMask )

  • nID -  ID of  a bitmap resource
  • nWidth - Width of one image
  • nHeight - Height of your image
  • crTransparentMask - color displayed transparently (normaly RGB(255, 255, 255) Magenta)


BOOL CButtonTestDlg::OnInitDialog()
  m_btn_OK.SetBitmaps(IDB_BITMAP1, 18, 20, RGB(255, 0, 255));
  return TRUE;


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

Systems Engineer
Germany Germany
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralBorder at click Pin
stephanl211116-Mar-04 2:45
memberstephanl211116-Mar-04 2:45 
Generalis it possible in C# Pin
pareshgheewala8-Jan-03 9:07
memberpareshgheewala8-Jan-03 9:07 
GeneralRe: is it possible in C# Pin
datenkabel12-Sep-03 7:06
memberdatenkabel12-Sep-03 7:06 
QuestionWhat is it? Pin
Dave_3-Jan-03 9:21
memberDave_3-Jan-03 9:21 
AnswerRe: What is it? Pin
Craig Muller3-Jan-03 12:24
memberCraig Muller3-Jan-03 12:24 
AnswerIt seems a bad copy of CButtonST Pin
Davide Calabro8-Jan-03 3:50
memberDavide Calabro8-Jan-03 3:50 
GeneralRe: It seems a bad copy of CButtonST Pin
Larry Antram8-Jan-03 19:35
memberLarry Antram8-Jan-03 19:35 
GeneralSome comments... Pin
Nitron3-Jan-03 7:24
memberNitron3-Jan-03 7:24 
GeneralRe: Some comments... Pin
lauren3-Jan-03 9:22
memberlauren3-Jan-03 9:22 
GeneralRe: Some comments... Pin
Nitron3-Jan-03 13:44
memberNitron3-Jan-03 13:44 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.151126.1 | Last Updated 8 Jan 2003
Article Copyright 2003 by datenkabel
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid