c#隐藏TextBox中闪烁的光标

方案:调用Windows API

1> 将TextBox的TabStop设置为false;

2> 在程序中相应位置加入下列代码

using System.Runtime.InteropServices;
……
[DllImport(
"user32", EntryPoint = "HideCaret")]
private static extern bool HideCaret(IntPtr hWnd);
……
在TextBox的MouseDown事件中添入:
HideCaret(((TextBox)sender).Handle);
原文地址:https://www.cnblogs.com/hyruur/p/2064139.html