本文整理汇总了C#中System.Windows.Forms.NotifyIcon.Click事件的典型用法代码示例。如果您正苦于以下问题:C# NotifyIcon.Click事件的具体用法?C# NotifyIcon.Click怎么用?C# NotifyIcon.Click使用的例子?那么, 这里精选的事件代码示例或许可以为您提供帮助。您也可以进一步了解该事件所在类System.Windows.Forms.NotifyIcon
的用法示例。
在下文中一共展示了NotifyIcon.Click事件的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeContextMenu
// 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 =
SystemInformation.PrimaryMonitorMaximizedWindowSize;
System.Drawing.Point menuPoint =
new System.Drawing.Point(windowSize.Width-180,
windowSize.Height-5);
menuPoint = this.PointToClient(menuPoint);
NotifyIcon1.ContextMenu.Show(this, menuPoint);
}