开发者

Preventing a RichTextBox operation from being added to the control's Undo stack

开发者 https://www.devze.com 2022-12-25 11:49 出处:网络
Editing a RichTextBox control\'s text (more specifically, modifying selection font/color) programmatically seems to be tracked in the control\'开发者_C百科s built in undo stack. Is there a way, short

Editing a RichTextBox control's text (more specifically, modifying selection font/color) programmatically seems to be tracked in the control'开发者_C百科s built in undo stack. Is there a way, short of writing my own undo/redo "manager", to prevent certain actions/operations from being added to the undo stack ?


No cando. At best you can flush the undo stack completely by sending EM_SETUNDOLIMIT twice. EM_SETTEXTEX offers the same option with the ST_DEFAULT flag. Surely not what you want. Look at ScintillaNET for a real editor.


If you came here when searching for a WPF c# answer you have a good one here Answered


Actually you can easily do this by implementing some of the ITextDocument interface and sending tomSuspend and tomResume as a count argument to the Undo handler.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号