xxxxxxxxxx
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsApp
{
public partial class Form1 : Form
{
[DllImport("user32")]
private static extern bool HideCaret(IntPtr hWnd);
public Form1()
{
InitializeComponent();
textBox1.GotFocus += textBox1_GotFocus;
}
private void textBox1_GotFocus(object sender, EventArgs e)
{
HideCaret(textBox1.Handle);
}
}
}