NotifyIcon.Click Event


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Occurs when the user clicks the icon in the notification area.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public event EventHandler Click

For more information about handling events, see NIB: Consuming Events.

The following code example demonstrates handling the Click event. This example assumes that you have added the code to a form containing a NotifyIcon object named NotifyIcon1.

// Initalize the NofifyIcon object's shortcut menu.
private void InitializeContextMenu()
	MenuItem[] menuList = new MenuItem[]{new MenuItem("Sign In"),
		new MenuItem("Get Help"), new MenuItem("Open")};
	ContextMenu clickMenu = new ContextMenu(menuList);
	NotifyIcon1.ContextMenu = clickMenu;

	// Associate the event-handling method with 
	// the NotifyIcon object's click event.
	NotifyIcon1.Click +=new System.EventHandler(NotifyIcon1_Click);

// When user clicks the left mouse button display the shortcut menu.  
// Use the SystemInformation.PrimaryMonitorMaximizedWindowSize property
// to place the menu at the lower corner of the screen.
private void NotifyIcon1_Click(object sender, System.EventArgs e)
	System.Drawing.Size windowSize = 
	System.Drawing.Point menuPoint = 
		new System.Drawing.Point(windowSize.Width-180, 
	menuPoint = this.PointToClient(menuPoint);

	NotifyIcon1.ContextMenu.Show(this, menuPoint);


.NET Framework
Available since 1.1
Return to top