?
Solved

Rich edit control: Fast Text Formatting

Posted on 1997-03-04
5
Medium Priority
?
419 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 600 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
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 this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

764 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