日期:2014-05-20 浏览次数:20954 次
[DllImport("user32.dll", EntryPoint = "HideCaret")]
public static extern bool HideCaret(IntPtr hWnd);
textBox1.GotFocus += new EventHandler(textBox_GotFocus);
textBox1.MouseDown += new MouseEventHandler(textBox_MouseDown);
textBox2.GotFocus += new EventHandler(textBox_GotFocus);
textBox2.MouseDown += new MouseEventHandler(textBox_MouseDown);
void textBox_GotFocus(object sender, EventArgs e)
{
HideCaret(((TextBox)(sender)).Handle);
}
private void textBox_MouseDown(object sender, MouseEventArgs e)
{
HideCaret(((TextBox)(sender)).Handle);
}