RichTextBox Speed

G

Guest

I am building an IRC client in C#. I am having trouble displaying the messages in a quick and efficient manner. I need to format the messages (font size, font color, etc) as they arrive from the server

Everything I have read says to use the RichTextBox. The problem is that the RichTextBox is too slow. It flickers and the text scrolls much too slow. I have tried various "hacks" to get rid of the flicker and speed up the update, but nothing seems to work. The various methods I have tried include preventing the control from redrawing itself by calling the WM_SETREDRAW method

Is there any way to "speed up" the RichTextBox? Can I create a control that inherits from the RichTextBox class and somehow make it update faster? For that matter, can I create a control that inherits from the TextBox class and make it support text formatting

Here is the code I am using right now to add formatted text to the RichTextBox control (the slow code)

textMessage.SuspendLayout()
textMessage.Select(vAdvRichTextBox.Text.Length, 0)
textMessage.SelectedText = vText
textMessage.Select(vAdvRichTextBox.Text.Length - vText.Length + 1, vText.Length)
textMessage.SelectionColor = vForeColor
textMessage.SelectionFont = vFont
textMessage.ResumeLayout(true)
textMessage.SelectionStart = vAdvRichTextBox.Text.Length
textMessage.SelectionLength = 0
textMessage.ScrollToCaret()

Any ideas
Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top