[C#]使用ShowCaret amp; HideCaret控制元件上的插入符號
[DllImport("user32.dll")]
static extern bool HideCaret(IntPtr hWnd);</pre></div>
namespace WindowsFormsApplication22 { public partial class Form1 : Form { [DllImport(“user32.dll”)] static extern bool ShowCaret(IntPtr hWnd);
[DllImport("user32.dll")]
static extern bool HideCaret(IntPtr hWnd);
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (rbtnShowCaret.Checked)
{
ShowCaret(textBox1.Handle);
}
else
{
HideCaret(textBox1.Handle);
}
}
}
}