2009-04-30 15 views
3

我正在開發.NET 3.5中的用戶控件。作爲對某些事件的反應,我想在此控件上顯示一個包含簡短文本的簡單氣泡,與着名的系統托盤通知氣泡類似。我相信這是一項非常簡單的任務,你能否給我一個快速提示?C#如何在用戶控件上顯示文本氣泡?

+0

WinForms或WPF? – billb 2009-04-30 11:18:11

+0

WinForms。 – mafu 2009-04-30 11:22:17

回答

9

使用ToolTip

System.Windows.Forms.ToolTip myToolTip = new System.Windows.Forms.ToolTip(); 
myToolTip.IsBalloon = true; 
myToolTip.Show("Some text", this.WhereToShow); 
0

你可以使用這個彈出的控制(在WPF)

MSDN

5

使用ToolTip類 - 設置IsBalloon = true得到泡沫效應。

3

降一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);