C# 如何在用户控件上显示文本气泡?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/806420/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C# How to show a text bubble on a user control?
提问by mafu
I'm developing an user control in .NET 3.5. As reaction to some event, I would like to show a simple bubble containing a short text on this control, similar to the well-known system tray notification bubbles. I'm sure this is a very easy task, could you give me a quick hint?
我正在 .NET 3.5 中开发用户控件。作为对某些事件的反应,我想在此控件上显示一个包含简短文本的简单气泡,类似于众所周知的系统托盘通知气泡。我确定这是一项非常简单的任务,你能给我一个快速提示吗?
采纳答案by jonny
回答by Tim Robinson
Use the ToolTip
class -- set IsBalloon
= true
to get the bubble effect.
使用ToolTip
类--set IsBalloon
=true
获得气泡效果。
回答by Nathan Ridley
Drop a NotifyIconcontrol onto your form, then call the ShowBalloonTipmethod of your control.
将NotifyIcon控件拖放到窗体上,然后调用控件的ShowBalloonTip方法。
System.Windows.Forms.NotifyIcon myIcon; // generated by the designer
// more designer code, then your code:
myIcon.ShowBalloonTip(3000, "My Title", "My Text", someIconReference);