Board index » cppbuilder » Format text within TStringGrid Cell

Format text within TStringGrid Cell

I would like to format the text within a TStringGrid cell so that it could
be centered, right justified, or multi-line. I have done this before, but
it's been so long I can't remember how I did it. Anyone know how to do it?
 

Re:Format text within TStringGrid Cell


Use the OnDrawCell event to draw the cells yourself

Gambit

Quote
"Steve" <tr...@eng.utah.edu> wrote in message news:3c0ff57d$1_2@dnews...
> I would like to format the text within a TStringGrid cell so that it could
> be centered, right justified, or multi-line. I have done this before, but
> it's been so long I can't remember how I did it. Anyone know how to do it?

Re:Format text within TStringGrid Cell


I think you have to handle the OnDrawCell event.

HTH

Piero

"Steve" <tr...@eng.utah.edu> ha scritto nel messaggio
news:3c0ff57d$1_2@dnews...

Quote
> I would like to format the text within a TStringGrid cell so that it could
> be centered, right justified, or multi-line. I have done this before, but
> it's been so long I can't remember how I did it. Anyone know how to do it?

Re:Format text within TStringGrid Cell


Actually, the real problem I'm having is formating the text. It seems before
there was some WINAPI call that I used or maybe some method within the VCL.
I can't remember. I've done this before where I wanted the line to wrap
within the cell rather than be truncated. It seems like there was a method
that took care of this for me.

Thanks for your help.

Steve

Quote
"Remy Lebeau" <gambi...@gte.net> wrote in message news:3c100ce3$1_1@dnews...
> Use the OnDrawCell event to draw the cells yourself

> Gambit

> "Steve" <tr...@eng.utah.edu> wrote in message news:3c0ff57d$1_2@dnews...
> > I would like to format the text within a TStringGrid cell so that it
could
> > be centered, right justified, or multi-line. I have done this before,
but
> > it's been so long I can't remember how I did it. Anyone know how to do
it?

Re:Format text within TStringGrid Cell


Thanks! That's what I've been looking for.

Steve

Quote
"Remy Lebeau" <gambi...@gte.net> wrote in message news:3c111e35_1@dnews...
> The Win32 API function DrawText() is the function I prefer to use, it's
very
> flexible in the ways it can format the text to a HDC (which you can
retreive
> from the grid's Canvas->Handle property)

> Gambit

> "Steve" <tr...@eng.utah.edu> wrote in message news:3c110e7a$1_2@dnews...
> > Actually, the real problem I'm having is formating the text. It seems
> before
> > there was some WINAPI call that I used or maybe some method within the
> VCL.
> > I can't remember. I've done this before where I wanted the line to wrap
> > within the cell rather than be truncated. It seems like there was a
method
> > that took care of this for me.

Re:Format text within TStringGrid Cell


The Win32 API function DrawText() is the function I prefer to use, it's very
flexible in the ways it can format the text to a HDC (which you can retreive
from the grid's Canvas->Handle property)

Gambit

Quote
"Steve" <tr...@eng.utah.edu> wrote in message news:3c110e7a$1_2@dnews...
> Actually, the real problem I'm having is formating the text. It seems
before
> there was some WINAPI call that I used or maybe some method within the
VCL.
> I can't remember. I've done this before where I wanted the line to wrap
> within the cell rather than be truncated. It seems like there was a method
> that took care of this for me.

Other Threads