Author Topic: Using RichTextBox (barf)  (Read 1409 times)

0 Members and 1 Guest are viewing this topic.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 12907
  • Activity:
    0%
  • Reputation Power: 149
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Jesse
  • Respect: +1328
  • Referrals: 32
    • View Profile
    • ScriptUO
Using RichTextBox (barf)
« on: June 29, 2008, 01:23:10 AM »
0
If you are one of the unfortunate few who needs to use the RichTextBox for your text display project, I do feel sorry for you.  If you can get along by just using the same font/size/style, then you won't have a performance problem.  However, if you try and do much formatting of the text for coloration or style changes, you will find that this .NET control is abhorrently slow. 

Finally, for ScriptUO I had to write a set of routines to quickly context color the text.  If you use the methods included with the base class, you can expect a control containing 150K bytes, or about 5500 lines of text to take more than 4 MINUTES to color.  Yes, MINUTES. 

Since this was waaaaay too long, I found myself looking for a better way to do this, but still trying to utilize the RTB control.  I finally came up with a set of routines which I could write to the control directly with Rich Text Formatted syntax, and quickly draw the control content.  The 4 minutes was trimmed to just under 1 second.

I'm going to post the code I came up with in hopes that it'll help someone who's stuck using this control.  Ultimately I had to dump the RTB completely since there was still performance issues during editing of such large amounts of data that require constant formatting. 

So keep checking back and hopefully soon I'll have this code ready for generic deployment.

TM
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline foobio

  • Newbie
  • *
  • Posts: 6
  • Activity:
    0%
  • Reputation Power: 1
  • foobio has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Using RichTextBox (barf)
« Reply #1 on: April 28, 2012, 05:14:15 PM »
0
Microsoft stuff in general isn't that hot for performance.

I think the data grids in .net were coded by a room of monkeys with typewriters.  We have gone 3rd party for all UI elements.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 12907
  • Activity:
    0%
  • Reputation Power: 149
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Jesse
  • Respect: +1328
  • Referrals: 32
    • View Profile
    • ScriptUO
Re: Using RichTextBox (barf)
« Reply #2 on: April 29, 2012, 10:27:32 PM »
0
It really is a shame that the stock .NET elements aren't really all that useful.  It's because of the lame basic implementation of most controls that I was very shy of .NET for quite some time.  Once you see how they perform in real situations, you just begin to wonder just how crappy the rest of the stuff Microsoft codes actually is.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Crome969

  • RebirthUO - Developer
  • Elite
  • *
  • *
  • Posts: 2083
  • Activity:
    0%
  • Reputation Power: 24
  • Crome969 might someday be someone...Crome969 might someday be someone...Crome969 might someday be someone...Crome969 might someday be someone...
  • Gender: Male
  • StealthUO - Developer
  • Respect: +209
  • Referrals: 9
    • View Profile
    • RebirthUO - UO Freeshard
Re: Using RichTextBox (barf)
« Reply #3 on: April 30, 2012, 12:15:22 AM »
0
.net offers a lot , but when it comes to time critical stuff you will work as best near to binaries. Win32 API is not bad as well but not such easy as forms in c# basicly. Alternate UIs i never tested but they could be helpful as well. Its more a shame, that Forms in UI never got a real reformation to work more time critical....

Tags: