S
sb
My app needs to load a plaintext file (1 to 15MBs), edit & convert it to
rtf, and finally output it to a RichTextBox (RTB). Simple enough...
Loading a 5MB file (average case for this app) and editing/converting it to
an rtf string takes about 1 second to accomplish...no big deal. However,
doing a "myRTB.Rtf = myRtfString;" takes another 25-30 more seconds!.
That's even after I've hidden the RTB and prevented the underlying RichEdit
control from generating WM_PAINT & other events while I'm updating it (via
SendMessage SET_REDRAW & EM_SETEVENTMASK respectively).
Anyway, I'm out of ideas when it comes to speeding up the RTB since it seems
from my research that slowness is a longstanding problem with the underlying
RichEdit. I should also mention that I don't want to get into partial
loading/editing...I've tried it...it had its own set of issues.
So in light of the above problem...is there a safe way to update the
RTB's.Rtf property from within a thread? My goal now is to:
a) update the RTB in the background thread (if possible) so I don't lost
app responsiveness
b) allow a user to cancel the operation if they choose to do so
TIA!
-sb
rtf, and finally output it to a RichTextBox (RTB). Simple enough...
Loading a 5MB file (average case for this app) and editing/converting it to
an rtf string takes about 1 second to accomplish...no big deal. However,
doing a "myRTB.Rtf = myRtfString;" takes another 25-30 more seconds!.
That's even after I've hidden the RTB and prevented the underlying RichEdit
control from generating WM_PAINT & other events while I'm updating it (via
SendMessage SET_REDRAW & EM_SETEVENTMASK respectively).
Anyway, I'm out of ideas when it comes to speeding up the RTB since it seems
from my research that slowness is a longstanding problem with the underlying
RichEdit. I should also mention that I don't want to get into partial
loading/editing...I've tried it...it had its own set of issues.
So in light of the above problem...is there a safe way to update the
RTB's.Rtf property from within a thread? My goal now is to:
a) update the RTB in the background thread (if possible) so I don't lost
app responsiveness
b) allow a user to cancel the operation if they choose to do so
TIA!
-sb