简体   繁体   中英

Control to show text based on where mouse pointer is

How do i get this? Which control shows some text when i keep the mouse cursor there for a while?

在此输入图像描述

Edit: I have a timeline in my program. I want the tooltip to show the time value in milliseconds at the point where the mouse cursor is... Is it possible to have a flexible tooltip over a control?

You are asking for the ToolTip control.


Refer to the following:

Tooltip in C#

普通工具提示

气球工具提示

ToolTip is the magic word. Have a look at the docs .

I think this is what you're looking for

How To Add ToolTips To Controls On A Windows Form

if you want to display some text over the print button named "printBtn", Then add the event mouse hover as below

printBtn.MouseHover += new EventHandler(printBtn_MouseHover);

Then, use the following code to display the text when the mouse is over the print button

void printBtn_MouseHover(object sender, EventArgs e)
{
   ToolTip tip = new ToolTip();
   tip.SetToolTip(printBtn, "Click to print");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM