2009-05-07 2 views

Trả lời

12

này nên làm điều đó cho bạn:

private void notifyIcon1_Click(object sender, EventArgs e) 
     { 
      contextMenuStrip1.Show(Cursor.Position.X, Cursor.Position.Y); 
     } 
+0

Ngoài ra, nếu bạn cần di chuyển các nội dung xung quanh bạn có thể luôn làm X +/- 10 hoặc gì đó – CodeLikeBeaker

8

Một phương pháp thay thế mà tôi đã tìm thấy để làm việc tốt hơn một chút:

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); 
     } 
    }