如何在 System.Windows.Forms.TextBox 中隐藏输入插入符号? [英] How do I hide the input caret in a System.Windows.Forms.TextBox?
本文介绍了如何在 System.Windows.Forms.TextBox 中隐藏输入插入符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要显示可变长度的消息并允许选择文本.我已将 TextBox 设为只读,它不允许编辑文本,但仍显示输入插入符号.
I need to display a variable-length message and allow the text to be selectable. I have made the TextBox ReadOnly which does not allow the text to be edited, but the input caret is still shown.
闪烁的输入插入符号令人困惑.我如何隐藏它?
The blinking input caret is confusing. How do I hide it?
推荐答案
你可以通过win32调用来做
You can do through a win32 call
[DllImport("user32.dll")]
static extern bool HideCaret(IntPtr hWnd);
public void HideCaret()
{
HideCaret(someTextBox.Handle);
}
这篇关于如何在 System.Windows.Forms.TextBox 中隐藏输入插入符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文