How can I change label text by hover instead of clicking?  
Author Message
Vampire7639





PostPosted: Visual C# General, How can I change label text by hover instead of clicking? Top

In WordPad, you will see that if you hover over one of the toolbar icons, the message in the status bar changes to give information on each one, and reverts back when you are move the pointer away.

How am I able to do this in my own project Currently I have the following:


private void newTool_Click(object sender, EventArgs e)

{

helpStatus.Text = "Create a new text document";


How can I change this so that the new text is displayed when the button is hovered over instead of clicked on, and then change back again once the pointer has been moved

Is it something where it says newTool_Click Does the click part need to be changed to something else

Thanks,

Vampire



Visual C#4  
 
 
ahmedilyas





PostPosted: Visual C# General, How can I change label text by hover instead of clicking? Top

implement the MouseHover/MouseLeave event of the control in question. Once done, then just do your thing!

so if we had a button on the form and we had a label which shows us the friendly "tooltip", we implement the MouseHover to show us the text. Click on the button, view its events in the properties and select the lightning symbol - this will give you a list of events supported by that control in question. Then double click the MouseHover event. In here we do our code! so something like...

private sub button1_MouseHover(object sender, EventArgs e)

{

this.theLabel.Text = "I'm hovering over button1";

}

go back to the designer view and double click the MouseLeave event to create the other event. Something like...

private sub button1_MouseLeave(object sender, EventArgs e)

{

this.theLabel.Text = String.Empty;

}

is this what you are after



 
 
Vampire7639





PostPosted: Visual C# General, How can I change label text by hover instead of clicking? Top

Thanks I changed Click to Hover instead of MouseHover. I guess that's where I went wrong.