Re: Grids ?



That's exactly what I was looking for.. I had stored many code snippets into
my Code Librarian and, tragedy, I lost everything a few weeks ago.
I will have to do the same work again. BTW, is there something new or
different as Code Librarian ?

<alanglloyd@xxxxxxx> ha scritto nel messaggio
news:1163851158.580329.266430@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

On Nov 18, 9:23am, "FrancoJommi" <franco.jo...@xxxxxx> wrote:
Yes,thanks I am trying, but while I found how to change colors, I cannot
find how to align my strings (which in fact are numbers). Is there some
API
call or something else ?

Typically (with some alternatives) ...

with StringGrid1 do begin
if (ACol = 0) then begin
// if (ACol in [2,4,6..8]) then begin
// if (ARow = 0 then begin) // header row
Canvas.Font.Name := 'Arial';
Canvas.Font.Size := 12;
Canvas.FillRect(ARect);
DrawText(Canvas.Handle, PChar(Cells[ACol, ARow]), -1, ARect,
DT_CENTER or DT_VCENTER or DT_SINGLELINE);
// DrawText(Canvas.Handle, PChar(Cells[ACol, ARow]), -1, ARect,
// DT_RIGHT or DT_VCENTER or DT_SINGLELINE);
// DrawText(Canvas.Handle, PChar(Cells[ACol, ARow]), -1, ARect,
// DT_LEFTT or DT_VCENTER or DT_SINGLELINE);
end;

DrawText() is a WinAPI call - look in Delphi Win32 help or on MSDN
(Microsoft Developers Network) web-site, or get a library edition of
MSDN (best 120 I ever spent).

Alan Lloyd


.