覆盖 OnGotFocus 和 OnLostFocus 后文本框的插入符不会消失
我创建一个自定义控件,继承自Textbox,并重写控件中的函数OnGotFocus和OnLostFocus。
然后,当我使用该控件时,失去焦点后插入符号不会消失。 我检查了函数OnLostFocus中的属性IsFocused,该值是false。但是为什么插入符号没有消失?
谢谢。
I create a custom control, inherit from Textbox,and override the function OnGotFocus and OnLostFocus in control.
Then when I use the control, the Caret do not disappear after focus is lost.
I check the property IsFocused in function OnLostFocus, the value is false.But why the Caret do not disappear ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该在子类中的自定义逻辑之后调用基类的方法
base.OnGotFocus()
和base.OnLostFocus()
。You should call the base class' methods,
base.OnGotFocus()
andbase.OnLostFocus()
after your custom logic in the child class.