
February 2nd, 2006, 11:02 AM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
|
|
You can't do this with a TMemo because the underlying component doesn't support multiple fonts and colors in the same memo box. However, you can do it with a TRichEdit component which does support multiple fonts and colors in the same box.
I'm banging this code out off the top of my head, since I don't have Delphi installed on this computer, so it may not be completely correct, but you should get a general idea of how to do it:
Code:
RichEdit1.Lines.Add('The string is a long string of text characters.');
// Select 20 characters from the 5th one
RichEdit1.SelStart := 5;
RichEdit1.SelLength := 20;
// Now set the attributes for this chunk of text.
RichEdit1.SelAttributes.Style := [fsBold];
RichEdit1.SelAttributes.Color := clRed;
RichEdit1.SelAttributes.Name := 'Times New Roman';
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month
|