Solved

How to have a rollover effect on toolbar buttons?

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 178
modThree challenge 4 91
abstract class with all non abstract mentods 6 76
NotAlone Challenge 20 84
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.

821 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