473,473 Members | 2,164 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

RichTextBox question

Goal: text that is pasted in a RichTextBox control has to be formatted
(keywords should get another forecolor/style).

My first attempt to format the text was the traditional approach of
setting SelectionStart and SelectionLength, and then setting the
SelectionColor/SelectionFont.

This works fine for small updates, but when large amount of text is
pasted it takes seconds to format the whole text; sometimes it just
hangs. This is unacceptable.

Does anyone have any insight on how this can be done without the
performance problems?

Thanks!
--
Ludwig Stuyck
http://www.coders-lab.be
May 24 '06 #1
5 1473
take a look here -
http://groups.google.com/group/micro...95d959a0967bcb

I hope this helps
Galin Iliev[MCSD.NET]
www.galcho.com

May 24 '06 #2
On 24 May 2006 11:34:14 -0700, "Galcho[MCSD.NET]" <ga****@gmail.com>
wrote:
take a look here -
http://groups.google.com/group/micro...95d959a0967bcb

I hope this helps
Galin Iliev[MCSD.NET]
www.galcho.com


You mean working with RTF directly? Do you happen to know a library
that can do such RTF-manipulations?
--
Ludwig Stuyck
http://www.coders-lab.be
May 24 '06 #3
as Kevin Spencer said:
"Set the RichTextBox.SelectionColor property. Once set, the font color
will
be whatever you set it to. This applies to text that is appended to the

RichTextBox after setting the property. Otherwise, you can select text
already in the RichTextBox and set the SelectionColor to color that
text. "

I hope this helps
Galin Iliev[MCSD.NET]
www.galcho.com

May 24 '06 #4
On 24 May 2006 11:59:54 -0700, "Galcho[MCSD.NET]" <ga****@gmail.com>
wrote:
as Kevin Spencer said:
"Set the RichTextBox.SelectionColor property. Once set, the font color
will
be whatever you set it to. This applies to text that is appended to the

RichTextBox after setting the property. Otherwise, you can select text
already in the RichTextBox and set the SelectionColor to color that
text. "

I hope this helps
Galin Iliev[MCSD.NET]
www.galcho.com

So for example I set SelectionColor to red, and append some text, set
the SelectionColor to blue, append some other text, etc...

I tried it, but performance was still extremely poor :(
--
Ludwig Stuyck
http://www.coders-lab.be
May 24 '06 #5
I am sorry. I haven't tried to optimize performance of RichTextBox

Regards
Galin Iliev[MCSD.NET]
www.galcho.com

May 24 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: JRB | last post by:
I have a thread adding lines of text to a richtextbox on my windows form about every 1 second. I want the last line of text to always be visible, which it is until the box gets filled up. The last...
6
by: Just Me | last post by:
I've seen code that copies a bmp file into a RichTextBox by first putting it into the clipboard and then using Paste to get it into the RichtextBox. This destroys the clipboard contents. Is...
3
by: michael sorens | last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a very simple task but I cannot find information on this. I am using a RichTextBox as an output window. Some text I want to...
4
by: Franky | last post by:
What I want to do is delete the last line in a RichTextBox. The RichTextBox has a ReadOnly property called lines that seems like it might help but I cant figure out how to use it. Well, the...
1
by: eBob.com | last post by:
After a lot of debugging effort I have to conclude that it does. Or at least can. I take a substring (RichTextBox.Text.Substring) before setting SelectionStart and after and get a different...
1
by: teo | last post by:
hallo I'm with vs2005 fw 2..0 is there a way to "freeze" the richtextbox, so to avoid user from editing it? I can Enable=False, but it no more scrolls and the font-color becomes grayed. ...
1
by: dshubhangi | last post by:
hi I've set richtextbox OLEDropMode Manual,catched OLEDragDrop event & in that event written below code Richtextbox1.OLEObjects.add ,,data.files(1) Now I'm able to catch OLEDragDrop as well as...
0
by: Linda Liu[MSFT] | last post by:
Hi CES, Thank you for posting here! I notice that you post a same issue in the microsoft.public.dotnet.framework.windowsforms.controls newsgroup and I have replied to that thread. For your...
1
by: Andrus | last post by:
I need to save font selected by user by Ctrl+MouseWheel in Winforms RichTextBox. I tried override below but this does not remember font: in this method Font.Size property seems to be always...
1
by: shakti s | last post by:
hi, My aplologies if this is really a silly question. I am trying to read contents like images and tables from one rich text box and paste it into another RTF control(i.e. another Richtextbox)....
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.