在richtextbox 做select 的时候 避免重绘
[DllImport("user32")]
private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, IntPtr lParam);
private const int WM_SETREDRAW = 0xB;
//停止控件的重绘
private void BeginPaint()
{
SendMessage(richTextBox2.Handle, WM_SETREDRAW, 0, IntPtr.Zero);
}
//允许控件重绘.
private void EndPaint()
{
SendMessage(richTextBox2.Handle, WM_SETREDRAW, 1, IntPtr.Zero);
richTextBox2.Refresh();
}