Solved

Rich edit control: Fast Text Formatting

Posted on 1997-03-04
5
413 Views
Last Modified: 2013-12-03
I would like to display colured text inside of rich edit control. The text is not in RTF, so I have to set the color later using the EM_SETCHARFORMAT message.

Unfortunately this is very slow. Every time the message is sent RTF control rewraps and redraws.  It takes many seconds to load some 10 kilobytes of text.

Is there a faster way of setting the CharFormatting and show changes later when formatting is finished?
0
Comment
Question by:tomaz012197
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Expert Comment

by:gvg
ID: 1298892
How about hiding the text with EM_HIDESELECTION then
format the text and then unhide it.  
There probably is a better way to do this.
0
 

Author Comment

by:tomaz012197
ID: 1298893
I did the EM_HIDESELECTION, but this only hides the selection. The entire control is still rewrapped every time the EM_SETCHARFORMAT is sent.

The WM_SETREDRAW didn't help either!

0
 
LVL 23

Expert Comment

by:chensu
ID: 1298894
I don't think there is a faster way because that is done internally. Since a rich edit control is a window, you can use ShowWindow() to hide it before the EM_SETCHARFORMAT is sent and show it after.

0
 

Author Comment

by:tomaz012197
ID: 1298895

0
 

Accepted Solution

by:
Borka earned 200 total points
ID: 1298896

Well, there's a message, called WM_SETREDRAW.
You can:

// Assuming SetRedraw is a func. which sends WM_SETREDRAW
SetRedraw(hWnd, FALSE);
reformat your text and
SetRedraw(hWnd, TRUE);
UpdateWindow(hWnd);

Still, MsWord will probably do a job faster, but this
is the fastest solution available when using RichEdit.

Hav a nice day,
  Borka.

0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question