如何强制托盘图标的上下文菜单在单击而不是右键单击时显示。
我尝试过使用MouseClick事件,但事件参数的鼠标位置在x0y0。
发布于 2009-05-07 14:57:48
这应该会为你做好准备:
private void notifyIcon1_Click(object sender, EventArgs e)
{
contextMenuStrip1.Show(Cursor.Position.X, Cursor.Position.Y);
}发布于 2009-08-06 20:54:13
另一种我发现效果更好的方法:
private void notifyIcon1_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
System.Reflection.MethodInfo mi = typeof(NotifyIcon).GetMethod("ShowContextMenu", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
mi.Invoke(notifyIcon1, null);
}
}https://stackoverflow.com/questions/834907
复制相似问题