在myRichTextBox中键入一些文本后,单击 按钮或使用Ctrl + Z时没有任何反应...嗯......任何想法? I''m using a richTextBox for editing a source code (with Syntax Highlighting)of my own programming language...How come that myRichTextBox doesn''t respond to Undo/Redo functions by usingdefault shortcut keys, or even programaticaly (by using Button_onClickevent)? if(myRichTextBox.CanUndo == true){myRichTextBox.Undo();} After typing some text into myRichTextBox, nothing happens when clicking thebutton, or using Ctrl+Z... Umm... any idea?推荐答案 你好乔, Hi Joe, 我正在使用richTextBox编辑源代码(使用语法高亮显示)我自己的编程语言... 为什么myRichTextBox不会通过使用默认快捷键,甚至programaticaly(通过使用Button_onClick 事件)来响应撤销/重做功能? br /> if(myRichTextBox.CanUndo == true) { myRichTextBox.Undo(); } 在myRichTextBox中输入一些文字后,单击按钮,或者使用Ctrl + Z ...嗯...任何想法? I''m using a richTextBox for editing a source code (with Syntax Highlighting) of my own programming language... How come that myRichTextBox doesn''t respond to Undo/Redo functions by using default shortcut keys, or even programaticaly (by using Button_onClick event)? if(myRichTextBox.CanUndo == true) { myRichTextBox.Undo(); } After typing some text into myRichTextBox, nothing happens when clicking the button, or using Ctrl+Z... Umm... any idea? 你确定你已经处理了KeyDown或MenuItem_Click事件吗? 如果您有菜单和菜单项编辑/撤消那个menuitem的 快捷方式应该设置为Ctrl-Z。 撤消和按钮组合我没有任何问题。 /> 问候 Marcin Are You sure You have KeyDown or MenuItem_Click event handled? If You''ve got menu and menuitem "edit/undo" then that menuitem''sshortcut should be set to "Ctrl-Z".I didn''t have any problem with undo and button combination. Regards Marcin MarcinGrzêbski写道:Marcin Grzêbski wrote:您确定已经处理了KeyDown或MenuItem_Click事件吗?如果您有菜单和菜单项编辑/撤消那个menuitem'的快捷方式应该设置为Ctrl-Z... Are You sure You have KeyDown or MenuItem_Click event handled? If You''ve got menu and menuitem "edit/undo" then that menuitem''s shortcut should be set to "Ctrl-Z"... 哟,Marcin! ;) 我的所有其他richTextBox都没有问题,只有这个 一个......我仔细检查并调试了代码,所以我'我很确定我已经设定了一个很好的活动。我也很困惑!还有一件事:你不要必须为你的menuItemUndo设置一个快捷方式来实现这个功能 - 只需按 按默认快捷键(Ctrl + Z)你会从Windows(我猜)中通过 默认来达到撤销功能,但这不适用于我的RTB而我 我不知道为什么? Yo, Marcin! ;)I don''t have problems either with all of my other richTextBox, just thisone... I double checked and debugged the code, so I''m pretty sure that Ihave set a good event. I''m pretty confused also! One more thing: you don''thave to set a shortcut for your menuItemUndo to get this work - just bypressing the default shortcut keys (Ctrl+Z) you''ll reach the Undo feature bydefault from Windows (I guess), but that''s NOT working for my RTB and Idon''t know why? 你好乔, Hi Joe, MarcinGrzêbski写道: Marcin Grzêbski wrote:你是确定您已经处理了KeyDown或MenuItem_Click事件?如果您有菜单和菜单项编辑/撤消那个menuitem'的快捷方式应该设置为Ctrl-Z... Are You sure You have KeyDown or MenuItem_Click event handled?If You''ve got menu and menuitem "edit/undo" then that menuitem''sshortcut should be set to "Ctrl-Z"... Yo,Marcin! ;)我的所有其他richTextBox都没有问题,只有这个......我仔细检查并调试了代码,所以我很确定我是已经设定了一个好事件。我也很困惑!还有一件事:你不必为menuItemUndo设置一个快捷方式来完成这项工作 - 只需按按下默认快捷键(Ctrl + Z)你就会达到撤销功能通过默认来自Windows(我猜),但那不适用于我的RTB而且我不知道为什么? Yo, Marcin! ;) I don''t have problems either with all of my other richTextBox, just this one... I double checked and debugged the code, so I''m pretty sure that I have set a good event. I''m pretty confused also! One more thing: you don''t have to set a shortcut for your menuItemUndo to get this work - just by pressing the default shortcut keys (Ctrl+Z) you''ll reach the Undo feature by default from Windows (I guess), but that''s NOT working for my RTB and I don''t know why? 所以,它对我来说也很奇怪! " Ctrl + Z"组合在RichTextBox控件上正常工作;) ....直到我设置了Ctrl + Z单个MainMenu的菜单项上的快捷方式 检查是否有任何menuitem的快捷方式设置为Ctrl + Z 这是标准的RichTextBox .NET控件还是继承的 控件或全新控件? Marcin So, it looks very strange to me too! "Ctrl+Z" combination was working fine on RichTextBox control ;).... till i have set "Ctrl+Z" shortcut on single MainMenu''s menuitemCheck if You have any menuitem''s shortcut set to "Ctrl+Z" This is standard RichTextBox .NET control or it''s an inheritedcontrol or totaly new control? Marcin 这篇关于richTextBox UNDO / REDO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-21 00:10