Winforms treeview - 如何使用ctrl + c复制节点文本? [英] Winforms treeview - how can I use ctrl+c for copying the text of a node?

查看:109
本文介绍了Winforms treeview - 如何使用ctrl + c复制节点文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前遇到了一个问题:我有一个MultiSelectTreeView,我可以通过双击它来修改节点上的文本(但在中间保留一些时间),就像在普通的Windows中重命名文件一样。



现在当我在这个名称修改部分时,文本突出显示并且所有内容(像这样)我无法使用Ctrl + C复制文本。当你按下它时,我只能使用上下文菜单的复制功能,这需要比Ctrl + C多得多的时间。



这个场景中的快捷方式禁用,如果可以,我可以启用它们吗?



此外,我在复制/粘贴整个节点时已经实现了Ctrl + C / Ctrl + V的功能,所以这是不是我的问题。这个问题只与复制文本有关。



我想要显示的解决方案这里但我不太明白,因为我不知道将新控件从工具箱顶部拖放到表单上。意思是(我也无法打开设计师)



我尝试了什么:



我在Stack Overflow上问了同样的问题,但还没有收到答案:

链接到问题

解决方案

< blockquote>我注意到在编辑模式下按Ctrl + C时,它对整个节点使用普通的Ctrl + C处理程序,但在if条件下失败,检查是否选择了正确的东西(=节点)。





我只是添加了一个其他的,然后将选定的值复制到剪贴板,它完全正常工作!

我可能只需要在编辑模式下使用Ctrl + V做同样的事情。



天哪,我已经搜索了这么长时间的解决方案,谢谢Jochen Arndt在评论中为我提供了帮助节<!/ BLOCKQUOTE>

I'm currently running into a problem: I have a MultiSelectTreeView and I can modify the text on the node by double-clicking it (but leaving some time in between) like in normal Windows when you want to rename a file.

And now when I am in this name modification section where the text is highlighted and everything (like this) I can't use Ctrl+C to copy the text. I can only use the Copy function of the context menu when you press right click on it which takes considerably more time than Ctrl+C.

Are the shortcuts in this scenario disabled and if so can I enable them?

Also I have already implemented a functionality for Ctrl+C/Ctrl+V when copying/pasting an entire node, so that's not my question. This problem just has to do with copying the text.

I want to do the solution shown here but I don't quite understand it since I don't know for example what "Drop the new control from the top of the toolbox onto your form." means (I'm also not able to open the Designer)

What I have tried:

I've asked the same question on Stack Overflow but haven't received an answer yet:
Link to question

解决方案

I noticed that when pressing Ctrl+C in the edit mode it uses the normal Ctrl+C handler for entire nodes but "fails" there at an if condition which checks if the correct thing (=node) was selected.


I simply added an else to this which then copies the selected value to the clipboard and it works perfectly fine!
I'll probably just have to do the same thing with Ctrl+V in edit mode.

Gosh, I've searched so long for this solution, thanks to Jochen Arndt who provided me help in the comment section!


这篇关于Winforms treeview - 如何使用ctrl + c复制节点文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆