Solved

How to have a rollover effect on toolbar buttons?

Posted on 2000-02-24
2
201 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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 this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

717 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