473,665 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

3 New Member
How can I change the color of button on mouse move over it.
help .
Aug 29 '06 #1
3 7422
Banfa
9,065 Recognized Expert Moderator Expert
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
ramkishor
3 New Member
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 Recognized Expert Moderator Expert
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
17300
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 seems to be ignored completely, even when I try with window.setTimeout. So my two questions are: (1) Most important: Is there anything I can do so that I don't have to wait for the next mouse event before the cursor gets repainted. (2) Why...
7
21814
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
9712
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 button" http://developer.mozilla.org/en/docs/DOM:event.button Tracing of mouse clicks or mousedown/mouseup events looks not reliable, because mouse can be pressed elsewhere out of the html element (even outside of the browser) and then move over the...
5
2278
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 when i click the button, it will keep the status as visable even i move the mouse out from the button. Please help. Thanks. <SCRIPT> function makevisible(cur,which){ if (which==0) cur.filters.alpha.opacity=90
0
8348
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8779
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1761
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.