|
-
May 17th, 2010, 02:34 AM
#1
What to do if RichTextBox is not fast enough?
Hello, I have a problem.
What I need is to highlight multiple matches within some portion of text as the user types a search pattern. Right now I'm using a RichTextBox to highlight text. The highlighting takes place if a user changes the search pattern and naturally it happens with each key press. It works, but I'm experiencing a performance issues. If the text is large enough the highlighting takes too long (up to several seconds).
Facing that I tried to launch the highlighting procedure in a different thread aborting it and launching it again if the search pattern was changed during the highlighting but still I'm not satisfied with performance.
Now I'm asking if there some other control I could use to speed up the process?
-
May 17th, 2010, 02:35 AM
#2
Re: What to do if RichTextBox is not fast enough?
There's a submission in the CodeBank on high-speed syntax highlighting that I would assume would be relevant. I believe it was posted by Icyculur.
-
May 17th, 2010, 04:22 AM
#3
Re: What to do if RichTextBox is not fast enough?
In the past I have searched far and wide for a decent syntax highlighting RichTextBox, but I concluded that they don't exist. The RichTextBox is simply not fast enough with its Highlighting because you always have to resort to selecting a piece of text, and then changing the Selected____ property. It's fine for small texts, but anything over a few 100 lines (or even less usually) results in horrible lag.
There are much better syntax highlighting controls available, but as far as I know none of them are free. Names that come to mind are 'ActiPro' and 'Quantum Whale' (those are two companies that make them I believe). If this project is not for some company then I doubt you'd want to buy them though.
-
May 17th, 2010, 05:14 AM
#4
Re: What to do if RichTextBox is not fast enough?
 Originally Posted by jmcilhinney
There's a submission in the CodeBank on high-speed syntax highlighting that I would assume would be relevant. I believe it was posted by Icyculur.
I looked at the code and the only 'new feature' I saw was the 'lockwindowupdate' call when changing the .SelectionColor.
I'll try that but I doubt it will make any major performance improvement. 
The problem is that those 2 seconds the Icyculyr writes about is damn too slow for me.
Well, if this won't help I'm going to investigate the possibility of buying some third-party control.
By the way, would editing raw rtf codes make any difference? I've tried that before but either I was missing something or doing something wrong because my richtextbox did not respond to any changes I was making.
Last edited by cicatrix; May 17th, 2010 at 05:17 AM.
-
May 17th, 2010, 05:26 AM
#5
Addicted Member
Re: What to do if RichTextBox is not fast enough?
If you find a solution be sure to post it here, I've also tried adding syntax highlighting to .net always having to resort to lower level languages in the end. The controls are just too slow. Never had that problem with VB6 when I used it.
-
May 17th, 2010, 05:34 AM
#6
Re: What to do if RichTextBox is not fast enough?
Has anyone tried HTMLDocument with JavaScript for that?
-
May 17th, 2010, 08:15 AM
#7
Re: What to do if RichTextBox is not fast enough?
I think HTML with Regular Expressions should make a good combination. Never tried though.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|