Solved

Rich edit control: Fast Text Formatting

Posted on 1997-03-04
5
417 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

729 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