如何检测我是否右键单击NotifyIcon?
我尝试了这个但是"按钮"被取消标记。
private void noi_Click(object sender, EventArgs e)
{
if (e.Button == MouseButtons.Right)
{
MessageBox.Show("test");
}
}
答案 0 :(得分:0)
NotifyIcon具有ContextMenu属性。使用它。
答案 1 :(得分:0)
ContextMenu不是我想要的。但我找到了一种方法:
private void noi_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
LEFTORRIGHT = "left";
}
if (e.Button == MouseButtons.Right)
{
LEFTORRIGHT = "right";
}
}
private void noi_Click(object sender, EventArgs e)
{
if (LEFTORRIGHT == left)
{
}
if (LEFTORRIGHT == right)
{
}
}