473,394 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How can I change the color of button on mouse move over it

How can I change the color of button on mouse move over it.
help .
Aug 29 '06 #1
3 7404
Banfa
9,065 Expert Mod 8TB
Subclass the button and make it owner drawn and intercept the WM_MOUSEMOVE or WM_MOUSEHOVER events to tell when the mouse is over the button and then draw the button appropriately as required.

Not terribly easy I'd say.
Aug 29 '06 #2
Subclass the button and make it owner drawn and intercept the WM_MOUSEMOVE or WM_MOUSEHOVER events to tell when the mouse is over the button and then draw the button appropriately as required.

Not terribly easy I'd say.

how i intercept the WM_MOUSEMOVE or WM_MOUSEHOVER events.
Aug 30 '06 #3
Banfa
9,065 Expert Mod 8TB
Well that rather depends on the environment you are writing your program in (I have already assumed Windows so ignore this if you are using *nix) straight WIN32 or MFC.

Like a said you need to subclass the button and then add your ownhandlers. This is reasonably easy in MFC your just create a subclass from the CButton class and then add your message handlers to that new class. Then in the class Wizard you have to assign a variable to the Button with a type of CButton and then manually edit the header file for the window to change the class CButton to CMyButton.

In normal windows you need to subclass the button by using GetWindowLong to get the event handler for the button, store that event handler and use SetWindowLong to insert your onw event handler for the button. In your own event handler call the original event handler except for the messages you wish to intercept in order to change the button colour.
Aug 30 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Csaba2000 | last post by:
I have set onmousedown to change the cursor, but this setting is ignored (IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the mouse button is released. On Opera 7.01, the setting...
7
by: moondaddy | last post by:
in asp.net 2.0, i have a link buttonand want to change the forecolor in a mouse over event. how can I do this? -- moondaddy@noemail.noemail
6
by: marss | last post by:
Hi, How can I define in Firefox whether the left mouse button is pressed when I move mouse over a html element? The documentation says that "e.button == 0 for standard 'click', usually left...
5
by: perhapscwk | last post by:
I have something like below, normally when my mouse is over the button, it will change from less visible to visible, if mouse move away, it turn back to less visible. But now i want to make it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.