C# ContextMenu 删除默认选择
好吧,这个问题似乎太简单了,但我已经浪费了足够的时间来寻找如何做到这一点。我在移动设备上使用 CE 6.5,并且有一个包含六个菜单项的 ContextMenu。当菜单弹出时,列表中的第一个项目会自动突出显示。我想删除这个突出显示,因为它让我的一些用户感到困惑,认为这是当前状态。我查看了 ContextMenu 及其所有变量和 MenuItem,但尚未找到如何删除第一项的自动突出显示。主菜单也是如此。
Okay this may seem too simple of a question but I've wasted enough time looking for how to do this. I am using CE 6.5 on a mobile device and I have a ContextMenu with six MenuItems. When the Menu pops up the first Item in the list is automatically highlighted. I want to remove this highlight as it is confusing some of my users in thinking that it is the current state. I looked into ContextMenu and all its variables and MenuItem and haven't found out how to remove automatic highlight of first item. Same goes for a MainMenu's too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,我认为答案是,你不能。今天下午我付出了很大的努力来获取该菜单,但我只是无法获得操作系统允许我使用的有效 HMENU。如果你想继续尝试追寻我所走的道路,代码如下,但我真的认为这是一个死胡同。此时,如果您确实需要该功能,我会考虑 P/Invoking 菜单的所有内容(创建、填充等)。
编辑
我知道我在某个地方有代码可以完成所有这些工作。我们曾经销售一个商业 PopupMenu 控件,它包含了用于菜单创建的所有 P/Invoke。该控件的销量很小,因此几年前我们将其从我们的产品线中撤下。我现在已将其作为开源在 Codeplex 上发布。
I think the answer is, unfortunately, you can't. I put in a strong effort this afternoon to get hold of that menu and I just couldn't get a valid HMENU that the OS would allow me to use. If you want to continue trying to chase the path I was on the code is below, but I really think it's a dead-end. At this point I'd consider P/Invoking everything for the menu (creation, population, etc) if you really need that feature.
EDIT
I knew I had code somewhere for doing all of this. We used to sell a commercial PopupMenu control that wrapped up all of the P/Invokes for menu creation. Sales for the control were small, so we pulled it from our product line a few years ago. I've now released it as open source over on Codeplex.