473,406 Members | 2,377 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,406 software developers and data experts.

Hovering Buttons

Is it possible to hover a button and by doing so e.g.,
make it chage its color? Apart form a possible "yes",
please give a code example.

Zach.
Nov 17 '05 #1
3 1682
Making a hover button work on a Windows Form application (I assume that is
what you are looking for) you can simply add the following functions:

private void HoverButton_MouseEnter(object sender, System.EventArgs e)
{
if( sender is Button)
{
((Button)sender).BackColor = Color.Red;
}
}

private void HoverButton_MouseLeave(object sender, System.EventArgs e)
{
if( sender is Button)
{
((Button)sender).BackColor = SystemColors.Control;
}
}

Next, you’ll want to wire up the MouseEnter event from your buttons (that
you want affected) to call HoverButton_MouseEnter and their MouseLeave event
to call HoverButton_MouseLeave.

Finally, change the colors specified within those functions to whatever you
want.

Brendan
"Zach" wrote:
Is it possible to hover a button and by doing so e.g.,
make it chage its color? Apart form a possible "yes",
please give a code example.

Zach.

Nov 17 '05 #2
Thank you! Quite simple really, once you find out.
Greetings,
Zach.

"Brendan Grant" <gr****@NOSPAMdahat.com> wrote in message
news:4B**********************************@microsof t.com...
Making a hover button work on a Windows Form application (I assume that is
what you are looking for) you can simply add the following functions:

<snipped>
Nov 17 '05 #3
Only the problem is that System.WebUI.WebControls.Button does noy have
definitions for MouseEnter and MouseLeave. Is there a way around?
Zach
"Zach" <00@00.00> wrote in message
news:43**********************@news.freeler.nl...
Thank you! Quite simple really, once you find out.
Greetings,
Zach.

"Brendan Grant" <gr****@NOSPAMdahat.com> wrote in message
news:4B**********************************@microsof t.com...
Making a hover button work on a Windows Form application (I assume that is what you are looking for) you can simply add the following functions:

<snipped>

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul M. | last post by:
Hi, This might be more of an HTML question, but I'm encountering it via a javascript function. I'm trying to do rollovers without using images. Here's some of the code: <script...
1
by: Just Me | last post by:
With a TreeView control and a MouseHover event is there a way to determine which node we are hovering over? Thanks in advance
2
by: Just Me | last post by:
With a TreeView control and a MouseHover event is there a way to determine which node we are hovering over? Thanks in advance
3
by: teranews | last post by:
My question is this... Is 'LINK'ing a stylesheet required before 'IMPORT'ing another for successful hovering? I have a problem which cropped up with the introduction of IE 7 Beta 2... Yes.....
0
by: JoyFang | last post by:
How to get a UI control caption by mouse actions, such as hovering, clicking... For example: Hover mouse to a button "Open" and get text of "Open" in C# This might need to use MSAA...
0
by: celineMG | last post by:
Hi there, I'm kinda stuck with this hovering effect... I'm no good in VBA and I can't see how perl would help me (it usually gets me out of the muck... :o) ... just not this time!) Anyone with a...
1
by: max | last post by:
hello (is this a css or a javascript question? or both?) when hovering, I can change the background (bg) color of a field (div), e.g. http://www.bep-zuerich.ch/hover4.htm with javascript I...
19
by: Steve | last post by:
Hi there, I'm having a problem with a webpage where hoving over the top navigation links causes my footer to jump up to the centre of the page! It only happens with IE7, and works fine with the...
9
SamKL
by: SamKL | last post by:
http://primusint.info/test/index.php?page=products View in Firefox, first, hover over the Auburn link at the top of the list on the bottom right. Then view in IE6. The white box doesn't appear...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.