日期:2014-05-17 浏览次数:21482 次
void textBox1_GotFocus(object sender, EventArgs e)
{
HideCaret((sender as TextBox).Handle);
}
private void textBox1_MouseDown(object sender, MouseEventArgs e)
{
HideCaret((sender as TextBox).Handle);
}
[DllImport("user32", EntryPoint = "HideCaret")]
private static extern bool HideCaret(IntPtr hWnd);
private void Form1_Load(object sender, EventArgs e)
{
textBox1.GotFocus += textBox1_GotFocus;
textBox1.MouseDown += textBox1_MouseDown;
}
void textBox1_GotFocus(object sender, EventArgs e)
{
HideCaret((sender as TextBox).Handle);
}
void textBox1_MouseDown(object sender, MouseEventArgs e)
{
HideCaret((sender as TextBox).Handle);
}