覆盖 OnGotFocus 和 OnLostFocus 后文本框的插入符不会消失

发布于 2024-11-19 22:56:15 字数 163 浏览 0 评论 0原文

我创建一个自定义控件,继承自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技术交流群

发布评论

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

评论(1

故事灯 2024-11-26 22:56:16

您应该在子类中的自定义逻辑之后调用基类的方法 base.OnGotFocus()base.OnLostFocus()

You should call the base class' methods, base.OnGotFocus() and base.OnLostFocus() after your custom logic in the child class.

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