Click here to Skip to main content
Licence 
First Posted 2 Jan 2003
Views 107,592
Bookmarked 43 times

A button with rollover behavior using C++

By | 7 Jan 2003 | Article
This class provides a button with rollover behavior

Sample Image - demo.jpg

Introduction

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
button.

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

SetBitmaps

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)

Example

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

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

datenkabel

Systems Engineer

Germany Germany

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralBorder at click Pinmemberstephanl21111:45 16 Mar '04  
Generalis it possible in C# Pinmemberpareshgheewala8:07 8 Jan '03  
GeneralRe: is it possible in C# Pinmemberdatenkabel6:06 12 Sep '03  
QuestionWhat is it? PinmemberDave_8:21 3 Jan '03  
AnswerRe: What is it? PinmemberCraig Muller11:24 3 Jan '03  
AnswerIt seems a bad copy of CButtonST PinmemberDavide Calabro2:50 8 Jan '03  
GeneralRe: It seems a bad copy of CButtonST PinmemberLarry Antram18:35 8 Jan '03  
GeneralSome comments... PinmemberNitron6:24 3 Jan '03  
GeneralRe: Some comments... Pinmemberlauren8:22 3 Jan '03  
GeneralRe: Some comments... PinmemberNitron12:44 3 Jan '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web02 | 2.5.120517.1 | Last Updated 8 Jan 2003
Article Copyright 2003 by datenkabel
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid