C# 隐藏输入控件的光标

C# 隐藏输入控件的光标

功能代码

#region 隐藏光标

/// 
/// 隐藏控件的光标
/// 
/// 控件句柄
/// 
[DllImport("user32", EntryPoint = "HideCaret")]
private static extern bool HideCaret(IntPtr hWnd);

#endregion

示例代码

private void textBox_Content_MouseDown(object sender, MouseEventArgs e)
{
    HideCaret(textBox_Content.Handle);
}

private void textBox_Content_GotFocus(object sender, EventArgs e)
{
    HideCaret(textBox_Content.Handle);
}

你可能感兴趣的:(C#,程序开发笔记)