2010-08-23 75 views

回答

3

爲了顯示當你的圖標左擊

private void NotifyIcon_MouseClick(object sender, MouseEventArgs e) 
{ 
    if (e.Button == MouseButtons.Left) 
    { 
     MethodInfo methodInfo = typeof(NotifyIcon).GetMethod("ShowContextMenu", 
      BindingFlags.Instance | BindingFlags.NonPublic); 

     methodInfo.Invoke(this.notifyIcon, null); 
    } 
} 

要顯示的菜單中你的問題的按鈕被點擊

private void button1_Click(object sender, EventArgs e) 
{ 
    //Need to show the context menu here 
    MethodInfo methodInfo = typeof(NotifyIcon).GetMethod("ShowContextMenu", 
     BindingFlags.Instance | BindingFlags.NonPublic); 
    methodInfo.Invoke(this.notifyIcon, null); 
} 
當菜單
相關問題