拖放操作重置文本框的撤消堆栈

发布于 2024-11-16 10:11:44 字数 195 浏览 3 评论 0原文

我遇到了在文本框上执行放置操作时撤消堆栈被破坏的问题。

Reflector 没有提供任何关于 TextBox 如何处理此状态下的 Undo 堆栈的见解。

我还认为根本没有办法控制这个撤消堆栈,它完全是内部的。我在 MSDN 论坛上看到 MS 人员也说了很多同样的话。

任何人都知道如何防止文本框上的放置操作破坏其撤消历史堆栈?

I have an issue with the Undo stack being destroyed when doing a drop operation on a TextBox.

Reflector didn't give any insights on how the TextBox handles the Undo stack in this state.

I also see no way to control this Undo stack at all, that it is completely internal. I've seen the MS folks say much the same over at the MSDN forums.

Anyone have any ideas on how to prevent a drop action on a Textbox from destroying its Undo history stack?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌吟 2024-11-23 10:11:44

这并不能完全回答您的问题,但您可以管理自己的文本框撤消堆栈。有许多撤消框架可以在这方面提供帮助,或者如果这是唯一需要自定义撤消的文本框,您也可以推出自己的框架。

我碰巧在 Codeplex 上维护这些撤消框架之一。 “受监控的撤消框架” 监视数据更改、存储更改的值并提供简单的撤消方法/ 重做这些更改。

我也研究了反射器中文本框的实现。该代码并不简单,并且似乎遍历了相当大的代码库来进行文本处理。据我所知,可用于调整文本框撤消的唯一旋钮是打开/关闭撤消。除此之外,它似乎是一个黑匣子。

This isn't quite answering your question, but you could manage your own undo stack for the textbox. There are a number of Undo frameworks to help in this area, or you could roll your own if this is the only textbox that needs custom undo.

I happen to maintain one of these undo frameworks on Codeplex. The "Monitored Undo Framework" watches for changes to the data, stores the changed values, and provides simple methods for undoing / redoing these changes.

I have looked at the implementation of the TextBox in reflector too. The code is not trivial and appears to traverse a pretty large codebase for text handling. As far as I know, the only knob available for tweaking a textbox's Undo is to turn undo on / off. Beyond that, it seems to be a black box.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文