Most applications only have "Restore, Move, Size, Minimize, Maximize and Close", however MS SQL offers extra options "Help, Customize view". Along those lines, is it possible to add to the right click menu of an application in the task bar?
大多数应用程序只有“恢复,移动,大小,最小化,最大化和关闭”,但MS SQL提供了“帮助,自定义视图”的额外选项。沿着这些方向,是否可以在任务栏中添加应用程序的右键菜单?
Note: I'm not referring to an icon in the notification area next to the clock.
注意:我不是指时钟旁边的通知区域中的图标。
3 个解决方案
#2
2
This is a simpler answer I found. I quickly tested it and it works.
这是我发现的一个更简单的答案。我很快测试了它,它的工作原理。
My code:
private const int WMTaskbarRClick = 0x0313;
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WMTaskbarRClick:
{
// Show your own context menu here, i do it like this
// there's a context menu present on my main form so i use it
MessageBox.Show("I see that.");
break;
}
default:
{
base.WndProc(ref m);
break;
}
}
}
#3
0
I have created an app and used this code and it works nicely but I've run into a slight problem that goes one step further. I have created a context menu that is supposed to mimic the Windows System menu on right click. When right clicking the taskbar the context menu shows up, but the bottom of it stops at the top of the taskbar. The X position is perfect, but I would like the Y position to show over the taskbar like a normal Windows System Menu would. Is there any way to do this? Here is the code I put in instead of the MessageBox.Show from the above code.
我已经创建了一个应用程序并使用了这个代码并且它运行良好,但我遇到了一个更进一步的小问题。我创建了一个上下文菜单,可以模仿右键单击Windows系统菜单。右键单击任务栏时,将显示上下文菜单,但其底部将停止在任务栏的顶部。 X位置是完美的,但我希望Y位置显示在任务栏上,就像普通的Windows系统菜单一样。有没有办法做到这一点?这是我放入的代码,而不是上面代码中的MessageBox.Show。
contextMenuStrip.Show(Cursor.Position.X, Cursor.Position.Y);
#1
#2
2
This is a simpler answer I found. I quickly tested it and it works.
这是我发现的一个更简单的答案。我很快测试了它,它的工作原理。
My code:
private const int WMTaskbarRClick = 0x0313;
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WMTaskbarRClick:
{
// Show your own context menu here, i do it like this
// there's a context menu present on my main form so i use it
MessageBox.Show("I see that.");
break;
}
default:
{
base.WndProc(ref m);
break;
}
}
}
#3
0
I have created an app and used this code and it works nicely but I've run into a slight problem that goes one step further. I have created a context menu that is supposed to mimic the Windows System menu on right click. When right clicking the taskbar the context menu shows up, but the bottom of it stops at the top of the taskbar. The X position is perfect, but I would like the Y position to show over the taskbar like a normal Windows System Menu would. Is there any way to do this? Here is the code I put in instead of the MessageBox.Show from the above code.
我已经创建了一个应用程序并使用了这个代码并且它运行良好,但我遇到了一个更进一步的小问题。我创建了一个上下文菜单,可以模仿右键单击Windows系统菜单。右键单击任务栏时,将显示上下文菜单,但其底部将停止在任务栏的顶部。 X位置是完美的,但我希望Y位置显示在任务栏上,就像普通的Windows系统菜单一样。有没有办法做到这一点?这是我放入的代码,而不是上面代码中的MessageBox.Show。
contextMenuStrip.Show(Cursor.Position.X, Cursor.Position.Y);