BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

String special formating

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Vladimir Stefanovic
Guest





PostPosted: Wed Apr 28, 2004 1:56 pm    Post subject: String special formating Reply with quote



Hello,

I saw some apps that have a TreeView or ListBox
which can host string items that are formated (colors
and font syles) . The classic example can be some
'Grep' like app that marks the words it has found.

I mean - the SAME string item has more than one
color and font style.

Is there some way to accomplish that with standard
VCL components? I need just tips...

Thanks,
Vladimir Stefanovic



Back to top
Eelke Klein
Guest





PostPosted: Wed Apr 28, 2004 2:08 pm    Post subject: Re: String special formating Reply with quote



Vladimir Stefanovic wrote:
Quote:
Hello,

I saw some apps that have a TreeView or ListBox
which can host string items that are formated (colors
and font syles) . The classic example can be some
'Grep' like app that marks the words it has found.

I mean - the SAME string item has more than one
color and font style.

Is there some way to accomplish that with standard
VCL components? I need just tips...
The TTreeView has some CustomDraw events while the TListView has the

OwnerDraw property and some events. More information can be found in the
BCB help.

Eelke

Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Apr 28, 2004 5:21 pm    Post subject: Re: String special formating Reply with quote



"Vladimir Stefanovic" <antivari (AT) ptt (DOT) yu> wrote


Quote:
Is there some way to accomplish that with
standard VCL components?

Simply owner-drawn the standard components. Many have an OwnerDraw property
and cooresponding OnDraw event(s). Simply draw on the component's Canvas
anyway you want. In the case of drawing a multi-colored string, you will
have to first change the Canvas's Pen/Font Color, then draw a piece of text,
then calculate the length of the piece using the Canvas's TextWidth()
method, then change the Color again, then draw another text piece of text
offsetted by the positioning and width of the previous piece, then calculate
the length of the new piece, and so on for all the colors that you want to
draw.


Gambit



Back to top
Vladimir Stefanovic
Guest





PostPosted: Wed Apr 28, 2004 6:36 pm    Post subject: Re: String special formating Reply with quote

Quote:
[...] In the case of drawing a multi-colored string, you will
have to first change the Canvas's Pen/Font Color, then draw a piece of
text,
then calculate the length of the piece using the Canvas's TextWidth()
method, then change the Color again, then draw another text piece of text
offsetted by the positioning and width of the previous piece, then
calculate
the length of the new piece, and so on for all the colors that you want to
draw.

This is quite enough information to start.
Thanks Remy.




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.