Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RichTextBox and font change

98 views
Skip to first unread message

Vivien Parlat

unread,
Oct 22, 2006, 1:05:00 AM10/22/06
to
Hello,

I'm trying to create a small text editor (to be included in another
project), and I've created two methods to toggle bold/italic/underlined
text styles, in order to have the same behaviour as WordPad has, ie :
if I select a text which has bold and non-bold parts, and click
"Italic", after that I have an italic-bold part and an italic-non-bold
one. This is not the case by default, and some programs I use don't
offer to do this.

My algorithm consists in moving the selection before each character,
isolating parts which have the same characteristic, and then use an
enhanced version of MSDN sample code to add or remove the style.

The point is, this takes time (on an Athlon XP 2200+...). If I have a
long selection, and make it bold, the user sees the cursor while it is
moving (to test "SelectedFont" attribute), and sees also the text
blocks being changed. So am I doing that the right way ? Isn't there a
better way to do it, or a way to disable RichTextBox graphical update
during the internal update ? Kind of a "BeginUpdate/EndUpdate", or
"DisablePaint/Repaint" pair, like for some double-buffer components
(when using OpenGL for example) ?

I use VC#2005, and .net framework 2.

Thanks in advance for any answer.

MikeY

unread,
Oct 22, 2006, 11:38:10 PM10/22/06
to
Vivien,

Try this link:
http://www.codeproject.com/cs/miscctrl/richtextboxextended.asp
This isa good place to find examples http://www.codeproject.com

Hope that helps

MikeY

"Vivien Parlat" <poc...@gmail.com> wrote in message
news:1161493500.5...@m73g2000cwd.googlegroups.com...

0 new messages