【发布时间】:2015-12-03 12:54:00
【问题描述】:
我在 Windows 窗体应用程序中使用 WebBrowser 控件作为文本编辑器。由于某些原因,我需要在某些操作后清除浏览器的撤消堆栈。为此,我使用
webBrowser1.Document.ExecCommand("ms-clearUndoStack", false, null);
它适用于除 Windows Vista 之外的所有操作系统。在 Vista 上,我得到以下 ArgumentException:
System.ArgumentException: Value does not fall within the expected range.
at System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument2.ExecCommand(String cmdID, Boolean showUI, Object value)
有没有办法避免异常,或者是否有其他方法可以清除撤消堆栈?
【问题讨论】:
标签: winforms webbrowser-control windows-vista