问题描述
我创建了一个自定义组合框(文本框,按钮和列表视图)。
键入文本框时,光标消失。如何在我的应用程序中禁用在键入时隐藏光标。
我goggled并发现它是名为SPI_SETMOUSEVANISH的系统行为。它可以关闭,但它会影响应用程序。
我怎样才能在我的自定义控件中关闭它?
I have created a custom combo box(Text box, button and List View).
While typing in the text box, cursor disappears. How can I disable "Hiding cursor while typing" in my application.
I goggled and found that it is the system behavior called SPI_SETMOUSEVANISH. It can be turned off but it will affect applications.
How can I turn-off this only in my custom control?
推荐答案
ListView.Capture=true;
我们可以保持鼠标指针而不隐藏。将ListView的Capture属性设置为true时,它将捕获鼠标事件,鼠标指针在TextBox中键入时不会消失。
另一个问题。
我使用的是RichTextBox而不是TextBox。上述技术不适用于RichTextBox。这意味着即使ListView.Capture = true,鼠标光标也会在输入RichTextBox时消失。
使用RichTExtBox和ListView.Capture = true时,ListView捕获鼠标移动和鼠标单击事件,但鼠标指针消失。有人知道为什么会这样吗?
we can keep the mouse pointer without hiding. While setting Capture property of ListView as true, It will capture the mouse events and mouse pointer wont be disappeared while typing in TextBox.
Another Problem.
I am using RichTextBox instead of TextBox. The above mentioned technique will not work with RichTextBox. That means mouse cursor will disappear while typing in RichTextBox even though ListView.Capture=true.
When using RichTExtBox and ListView.Capture=true, ListView captures mouse move and mouse click events but mouse pointer is disappearing. Any one know why it is happening like this?
这篇关于键入文本框时光标消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!