是否可以更改RichTextBox的插入符号大小?
我想更改Caret的Width
。
答案 0 :(得分:-1)
public partial class Form1 : Form
{
[DllImport("user32.dll")]
static extern bool CreateCaret(IntPtr hWnd, IntPtr hBitmap, int nWidth, int nHeight);
[DllImport("user32.dll")]
static extern bool ShowCaret(IntPtr hWnd);
public Form1()
{
InitializeComponent();
}
private void richTextBox1_KeyUp(object sender, KeyEventArgs e)
{
CreateCaret(richTextBox1.Handle, IntPtr.Zero, 10, richTextBox1.Font.Height);
ShowCaret(richTextBox1.Handle);
}
}