I have a readonly data logging window that I implemented using the RichTextBox control. I\'d like to be able to disable the autoscrolling that happens when the user clicks
You might take a look at doing something like this:
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
private static extern IntPtr LockWindowUpdate(IntPtr Handle);
then in your method that appends log data (I'm making some assumptions here) you might do something like this:
LockWindowUpdate(this.Handle);
int pos = richTextBox1.SelectionStart;
int len = richTextBox1.SelectionLength;
richTextBox1.AppendText(yourText);
richTextBox1.SelectionStart = pos;
richTextBox1.SelectionLength = len;
LockWindowUpdate(IntPtr.Zero);
I did a little test app with a timer that did the append on the richtextbox and it stopped it from scrolling so I could do the text selection. It has some positional issues and isn't perfect, but perhaps it'll help move you toward a solution of your own.
All the best!