Επεξεργασία

Κοινή χρήση μέσω


NotifyIcon.ShowBalloonTip Method

Definition

Displays the balloon tip in the taskbar.

Overloads

ShowBalloonTip(Int32)

Displays a balloon tip in the taskbar for the specified time period.

ShowBalloonTip(Int32, String, String, ToolTipIcon)

Displays a balloon tip with the specified title, text, and icon in the taskbar for the specified time period.

ShowBalloonTip(Int32)

Source:
NotifyIcon.cs
Source:
NotifyIcon.cs
Source:
NotifyIcon.cs

Displays a balloon tip in the taskbar for the specified time period.

public:
 void ShowBalloonTip(int timeout);
public void ShowBalloonTip (int timeout);
member this.ShowBalloonTip : int -> unit
Public Sub ShowBalloonTip (timeout As Integer)

Parameters

timeout
Int32

The time period, in milliseconds, the balloon tip should display. This parameter is deprecated. Notification display times are now based on system accessibility settings.

Exceptions

timeout is less than 0.

Examples

The following code example demonstrates how to use the ShowBalloonTip method. To run this example, paste the example code into a Windows Form that contains a NotifyIcon named notifyIcon1. Call SetBalloonTip from the form's constructor or Load event-handling method.

private void SetBalloonTip()
{
    notifyIcon1.Icon = SystemIcons.Exclamation;
    notifyIcon1.BalloonTipTitle = "Balloon Tip Title";
    notifyIcon1.BalloonTipText = "Balloon Tip Text.";
    notifyIcon1.BalloonTipIcon = ToolTipIcon.Error;
    this.Click += new EventHandler(Form1_Click);
}

void Form1_Click(object sender, EventArgs e) 
{
    notifyIcon1.Visible = true;
    notifyIcon1.ShowBalloonTip(30000);
}
Private Sub SetBalloonTip()
    notifyIcon1.Icon = SystemIcons.Exclamation
    notifyIcon1.BalloonTipTitle = "Balloon Tip Title"
    notifyIcon1.BalloonTipText = "Balloon Tip Text."
    notifyIcon1.BalloonTipIcon = ToolTipIcon.Error

End Sub

Sub Form1_Click(ByVal sender As Object, ByVal e As EventArgs) _
    Handles Me.Click

    notifyIcon1.Visible = True
    notifyIcon1.ShowBalloonTip(30000)

End Sub

Remarks

Minimum and maximum timeout values are enforced by the operating system and are typically 10 and 30 seconds, respectively, however this can vary depending on the operating system. Timeout values that are too large or too small are adjusted to the appropriate minimum or maximum value. In addition, if the user does not appear to be using the computer (no keyboard or mouse events are occurring) then the system does not count this time towards the timeout.

Only one balloon tip can display on the taskbar at a time. Attempting to display a balloon tip when one is currently displayed on the taskbar causes the timeout value to be ignored. The behavior is slightly different depending on the operating system and whether the balloon tip is from another, or the same, application. When the second balloon tip is from another application, the first balloon tip will display for the minimum timeout value before the second appears, regardless of the value of timeout. In most cases, if the balloon tips are from the same application, the first balloon tip immediately closes when another call to the ShowBalloonTip method is made. In some cases the second balloon will open on top of the first balloon.

The title text will display in a bold font near the top of the balloon.

Applies to

ShowBalloonTip(Int32, String, String, ToolTipIcon)

Source:
NotifyIcon.cs
Source:
NotifyIcon.cs
Source:
NotifyIcon.cs

Displays a balloon tip with the specified title, text, and icon in the taskbar for the specified time period.

public:
 void ShowBalloonTip(int timeout, System::String ^ tipTitle, System::String ^ tipText, System::Windows::Forms::ToolTipIcon tipIcon);
public void ShowBalloonTip (int timeout, string tipTitle, string tipText, System.Windows.Forms.ToolTipIcon tipIcon);
member this.ShowBalloonTip : int * string * string * System.Windows.Forms.ToolTipIcon -> unit
Public Sub ShowBalloonTip (timeout As Integer, tipTitle As String, tipText As String, tipIcon As ToolTipIcon)

Parameters

timeout
Int32

The time period, in milliseconds, the balloon tip should display. This parameter is deprecated. Notification display times are now based on system accessibility settings.

tipTitle
String

The title to display on the balloon tip.

tipText
String

The text to display on the balloon tip.

tipIcon
ToolTipIcon

One of the ToolTipIcon values.

Exceptions

timeout is less than 0.

tipText is null or an empty string.

tipIcon is not a member of ToolTipIcon.

Examples

The following code example demonstrates how to use the ShowBalloonTip method. To run this example, paste the example code into a Windows Form that contains a NotifyIcon named notifyIcon1. Associate the Form1_DoubleClick method in this example with the form's DoubleClick event.

void Form1_DoubleClick(object sender, EventArgs e)
{
    notifyIcon1.Visible = true;
    notifyIcon1.ShowBalloonTip(20000, "Information", "This is the text",
        ToolTipIcon.Info );
}
Sub Form1_DoubleClick(ByVal sender As Object, ByVal e As EventArgs) _
        Handles Me.DoubleClick

    notifyIcon1.Visible = True
    notifyIcon1.ShowBalloonTip(20000, "Information", "This is the text", _
            ToolTipIcon.Info)
End Sub

Remarks

Minimum and maximum timeout values are enforced by the operating system and are typically 10 and 30 seconds, respectively, however this can vary depending on the operating system. Timeout values that are too large or too small are adjusted to the appropriate minimum or maximum value. In addition, if the user does not appear to be using the computer (no keyboard or mouse events are occurring) then the system does not count this time towards the timeout.

Only one balloon tip can display on the taskbar at a time. Attempting to display a balloon tip when one is currently displayed on the taskbar causes the timeout value to be ignored. The behavior is slightly different depending on the operating system and whether the balloon tip is from another, or the same, application. When the second balloon tip is from another application, the first balloon tip will display for the minimum timeout value before the second appears, regardless of the value of timeout. In most cases, if the balloon tips are from the same application, the first balloon tip immediately closes when another call to the ShowBalloonTip method is made. In some cases the second balloon will open on top of the first balloon.

The title text will display in a bold font near the top of the balloon.

Applies to