Solved

How to have a rollover effect on toolbar buttons?

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 94
Include multiple hostnames in this command? 3 55
modThree challenge 4 96
EvenOdd challenge 10 125
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 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