WPF RichTextBox-如何检测OverTypeMode? [英] WPF RichTextBox - How to Detect OverTypeMode ?

查看:129
本文介绍了WPF RichTextBox-如何检测OverTypeMode?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够确定WPF RichTextBox中插入模式是否处于活动状态.我试过像这样使用反射:

I need to be able to determine if insert mode is active in a WPF RichTextBox. I tried using reflection like so:

PropertyInfo pInfo = this.GetType().GetProperty("_OvertypeMode", BindingFlags.NonPublic | BindingFlags.Instance);



但是,我可以找到的RichTextBox中不存在属性_OverTypeMode.

有谁知道该怎么做?

Google帮不上忙.



However, the property _OverTypeMode doesn''t exist in the RichTextBox that I could find.

Does anyone know how to do this?

Google was no help.

推荐答案

我发现在WPF中,实例化控件时,TextBoxRichTextBox始终默认为Insert为ON.有了这些知识,我就可以简单地跟踪Key.Insert的按下情况,并维护自己的指示状态的变量.

问题已解决.
I found out that in WPF, a TextBox or RichTextBox always defaults to Insert being ON when the control is instantiated. With that knowledge, I simply track the pressing of Key.Insert, and maintain my own variable that indicates status.

Problem solved.


这篇关于WPF RichTextBox-如何检测OverTypeMode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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