0
我有一個示例C#窗體表格here。我需要在鼠標左鍵單擊時顯示通知圖標的上下文菜單。我已經標記在哪裏寫所需的代碼如下:如何在點擊通知圖標時以編程方式顯示上下文菜單?
private void button1_Click(object sender, EventArgs e)
{
//Need to show the context menu here
}
請幫忙!
我有一個示例C#窗體表格here。我需要在鼠標左鍵單擊時顯示通知圖標的上下文菜單。我已經標記在哪裏寫所需的代碼如下:如何在點擊通知圖標時以編程方式顯示上下文菜單?
private void button1_Click(object sender, EventArgs e)
{
//Need to show the context menu here
}
請幫忙!
爲了顯示當你的圖標左擊
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);
}
當菜單