简体   繁体   English

如何将自己的项目添加到文本框的默认上下文菜单(剪切,复制,粘贴, <my item> )。

[英]How can I add my own item to the default context menu of a textbox (cut, copy, paste, <my item>).

I'm surprised how hard it is to find a solution to this question. 我很惊讶找到这个问题的解决方案有多么困难。 I can't seem to find anyone else asking it. 我似乎找不到其他人问。

I have some basic textbox controls on my form. 我的表单上有一些基本的文本框控件。 In addition to the standard cut/copy/paste options when you right click in the box, I want to add my own additional item. 右键单击框时,除了标准的剪切/复制/粘贴选项外,我还想添加自己的其他项目。

Any idea how I can achieve this? 知道我该如何实现吗? I don't even know where to start. 我什至不知道从哪里开始。

Thanks 谢谢

It's been suggested to implement your own menu; 建议您实现自己的菜单。 you can provide the default actions and add your own as well. 您可以提供默认操作 ,也可以添加自己的操作

I suggest checking out the control called ContextMenuControl. 我建议签出名为ContextMenuControl的控件。 This control allows you to create a menu and assign it to the controls that you would like to have this menu pop up with. 该控件允许您创建一个菜单,并将其分配给您希望弹出该菜单的控件。 then when a user right-clicks on the textbox, your menu will pop up. 然后,当用户右键单击文本框时,将弹出菜单。

Have a look at this: http://msdn.microsoft.com/en-us/library/aa984254(v=vs.71).aspx 看看这个: http : //msdn.microsoft.com/en-us/library/aa984254(v=vs.71).aspx

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

相关问题 将项添加到默认的TextBox上下文菜单 - Add item to the default TextBox context menu 如何在Windows 10 UWP应用程序中删除TextBox控件的默认“粘贴”上下文菜单项? - How can I remove the default “Paste” context menu entry of a TextBox control in a Windows 10 UWP app? VSTO C#/VBA 如何在上下文菜单 MS Project 2016+ 中添加我的菜单项 - VSTO C#/VBA how add my menu item in context menu MS Project 2016+ 如何在C#中剪切,复制,粘贴任何列表视图项? - How to cut, copy, paste any listview item in C#? 如何在Windows 7中将自己的项目添加到最小化应用程序的上下文菜单中? - How do I add my own items to the context menu of minimized applications in Windows 7? 我在资源管理器中有一个上下文菜单项,现在如何最好地在文件上调用进程? - I have a context menu item in Explorer, now how is it best to call my process on the file? 右键单击文本框时如何显示自己的菜单栏 - How can I show my own menu strip when Right-click in TextBox 如何在上下文菜单项上添加复选标记? - How to add a check mark on context menu item? 如何在上下文菜单的子菜单中添加子菜单项 - How to add a submenu item in submenu of Context menu 如何在上下文菜单项上放置事件? - How can i put an event on a context menu item?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM