如何以编程方式调用应用程序菜单?
我有自定义样式的非矩形透明窗口。
<Window
x:Class="TestWindow" x:Name="Window"
Width="350" Height="450" AllowsTransparency="True" WindowStyle="None"
WindowStartupLocation="CenterScreen" FontSize="14 px" FontFamily="Fonts/#Tahoma"
Background="Transparent">
我有一个标题和系统按钮的网格,并且想通过右键单击它来显示应用程序菜单。目前应用程序菜单只能通过按 ALT+空格键显示。 我该如何解决这个问题?
I have non-rectangular transparent window with custom style.
<Window
x:Class="TestWindow" x:Name="Window"
Width="350" Height="450" AllowsTransparency="True" WindowStyle="None"
WindowStartupLocation="CenterScreen" FontSize="14 px" FontFamily="Fonts/#Tahoma"
Background="Transparent">
I have a grid for title and system buttons and want to show application menu by right click on it. Currently app menu showing only by pressing ALT+Spacebar.
How can i solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
于是,在谷歌了两个小时后,我终于找到了解决方案。
步骤 1:像这样定义 RECT 结构:
步骤 2:导入两个 user32.dll 函数:
步骤 3:添加“鼠标右键单击标题”事件处理程序:
So, after a two hours spent in Google I finally found a solution.
Step1: define RECT structure like this:
Step2: import two user32.dll functions:
Step3: add 'right mouse button click on header' event handler:
我必须按如下方式更改 Raeno 的代码才能使菜单项正常工作...
这需要以下声明...
I had to change Raeno's code as follows to get the menu items to work...
This required the following declarations...