简体   繁体   English

Windows小工具上下文菜单

[英]Windows Gadget context menu

I my Gadget application i have an issue with showing standard gadget context menu. 我的小工具应用程序在显示标准小工具上下文菜单时出现问题。 The problem caused because of silverlight control, when i click right button Silverligh control handle contextmenu event. 由于Silverlight控件引起的问题,当我单击右键Silverlight控件处理contextmenu事件时。

So first my solution was to put on top of the silverlight control transprent web control (table). 因此,我的解决方案首先是将Silverlight控件透明Web控件(表)放在顶部。 Well that way i got good working gadget context menu and not working silverlight control. 那样的话,我得到了良好的小工具上下文菜单,而不是Silverlight控件。 So the next step was to make transperent web control invisible and handle oncontextmenu. 因此,下一步是使透明Web控件不可见,并处理oncontextmenu。 Like this. 像这样。

HTML 的HTML

<body oncontextmenu="ContextMenu();" onload="init();" >

JavaScript 的JavaScript

ContextMenu()
{
var vis = document.getElementById('overlapControl').style.visibility;
if (vis == "hidden") {
    document.getElementById('overlapControl').style.visibility = "visible";
    window.event.returnValue = false;
}

It's working with some glitches. 有一些小故障。 You need to make two right button clicks, and some event to hide transpanent control. 您需要单击两次右键,并单击一些事件以隐藏透明控件。 The second one is not a big problem, i can use onmouseover event for example to hide control. 第二个不是什么大问题,例如,我可以使用onmouseover事件来隐藏控件。 But a first one is a real pain in the neck. 但是第一个是颈部的真正疼痛。 Seems there is no way to show context menu with one click. 似乎无法一键显示上下文菜单。

Any ideas how to make it work. 任何想法如何使其工作。 or maybe other better solution. 或其他更好的解决方案。

Have you tried windowless mode? 您是否尝试过无窗模式? Here is a little more complicated example, but should give you some idea. 是一个更复杂的示例,但是应该给您一些想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM