Solved

How to have a rollover effect on toolbar buttons?

Posted on 2000-02-24
2
181 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

8 Experts available now in Live!

Get 1:1 Help Now