Solved

How to have a rollover effect on toolbar buttons?

Posted on 2000-02-24
2
186 Views
Last Modified: 2013-11-20
I have an SDI application with a toolbar.Using VC6.
 I want to change the button icon when the mouse is over the toolbar button.How is that possible?
 
0
Comment
Question by:sjhunjhunuwala
  • 2
2 Comments
 
LVL 3

Accepted Solution

by:
V_Bapat earned 50 total points
ID: 2557703

1. Take a look at the article "IE4 Style Menu (Rebar Menu)" by Janusz Jasinski on CodeGuru site (http://codeguru.developer.com).

2. Try this:
STEP 1 -> Create two bitmaps, one for normal appearence and second when the mouse is over the toolbar button. Let us say you name them as IDB_NORMAL and IDB_HILITE respectively.
STEP 2 -> In CMainFrame::OnCreate() add the following code before return statement.

CImageList imageList;
 CBitmap  bitmap;
 
 // Create and set the normal toolbar image list.
 bitmap.LoadBitmap(IDB_NORMAL);
 imageList.Create(21, 20, ILC_COLORDDB|ILC_MASK, 13, 1);
 imageList.Add(&bitmap, RGB(255,0,255));
 m_wndToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
 imageList.Detach();
 bitmap.Detach();

 // Create and set the hot toolbar image list.
 bitmap.LoadBitmap(IDB_HILITE);
 imageList.Create(21, 20, ILC_COLORDDB|ILC_MASK, 13, 1);
 imageList.Add(&bitmap, RGB(255,0,255));
 m_wndToolBar.SendMessage(TB_SETHOTIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
 imageList.Detach();
 bitmap.Detach();
 
See what happens? You can use this logic to solve the problem.

All the best.

Vicky
 
0
 
LVL 3

Expert Comment

by:V_Bapat
ID: 2557714
Hi Jhunjhunuwala
Check out some more article including the above mentioned one on
http://codeguru.developer.com/toolbar/index.shtml

Vicky
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Host to IP 7 77
MaxSpan challenge 9 82
Use of condition with 'serial' in ansible 2 50
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 78
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now