Board index » delphi » text formatting in RichEdit box

text formatting in RichEdit box

Delphi 2.0 Desktop.

How can one format some parts of the text (italic, bold, color, etc)
within a RichEdit box during run-time?

Thanks a lot!

Jeff

 

Re:text formatting in RichEdit box


Hi there,

Check out the RichEdit demo that comes with your Delphi 2 (in the demos
folder). Basically, it goes something like this:

myRichEdit.SelAttributes.Font.Style := [fsBold];

Cheers,
Martin

Quote
Jeffrey Tsai wrote:
> Delphi 2.0 Desktop.

> How can one format some parts of the text (italic, bold, color, etc)
> within a RichEdit box during run-time?

> Thanks a lot!

> Jeff

Re:text formatting in RichEdit box


In <3936B293.533AD...@mail.med.cornell.edu>, Jeffrey Tsai hastily scribbled:

Quote
> Delphi 2.0 Desktop.

> How can one format some parts of the text (italic, bold, color, etc)
> within a RichEdit box during run-time?

Set SelStart and SelLength to the text that you want to modify

Set the appropriate properties of SelAttributes, e.g. SelAttributes.Style := [fsItalic]
The first part is not necessarily simple if you're trying to identify the relevant text programmatically.  If you're just expecting the user to select it, then its done for you anyway.

Roger Morton
roger.mor...@dial.pipex.com

Other Threads