I'm writing IRC client with C#
I create RichTextBox-control for every channel window where all channel messages are written. Now of course text box is too small to hold every line of bulls**t people tend to write in IRC so I need to scroll text box somehow. This is a snippet of the code I'm working on:
// Finds the right channel window and control
RichTextBox box = FindChannelWindow(channelName).FindOutputBox();
box.Text += channelMessage + "
Then I have event-handler:
private void richTextBox1_TextChanged(object sender, System.EventArgs e)
RichTextBox box = sender as RichTextBox;
// Logging stuff
if (Settings.Logging) Logger.Write(ParseLastLine(box));
// Here I would like to scroll down the control
if (Box.Lines.Length > MaxLinesPerView)
I found that ScrollToCaret would scroll control where caret is currently but I don't like to se focus to text box, I want to keep focus where user writes all channel messages. So is there any way to scroll down the text box or do I have to hassle with focus and ScrollToCaret?