The following is causing a flicker when the height goes over 810.
How can I prevent this from happening?
private const int EM_GETLINECOUNT = 0xba;
[DllImport("user32",EntryPoint = "SendMessageA",CharSet = CharSet.Ansi,SetLastError = true,ExactSpelling = true)]
private static extern int SendMessage(int hwnd,int wMsg,int wParam,int lParam);
private void rtbScript_TextChanged(object sender,EventArgs e)
{
var numberOfLines = SendMessage(rtbScript.Handle.ToInt32(),EM_GETLINECOUNT,0,0);
this.rtbScript.Height = (rtbScript.Font.Height + 2) * numberOfLines;
if(this.rtbScript.Height>810)
{
this.rtbScript.Height = 810;
}
}