VCL Delphi

StringGrid bileseni hücrelerindeki metin, Grid1DrawCell olay yordamina eklenecek birkac satir kodla hizalanabilir.
procedure Tform1.Grid1DrawCell(Sender: TObject; Col, Row: Longint;
Rect: TRect; State: TGridDrawState);
var l_oldalign : word;
begin
if (row=0) or (col<2) then
grid1.canvas.font.style:=grid1.canvas.font.style+[fsbold];
if col<>1 then
begin
l_oldalign:=settextalign(grid1.canvas.handle,ta_right);
grid1.canvas.textrect(rect,rect.right-2, Rect.top+2,grid1.cells[col,row]);
settextalign(grid1.canvas.handle,l_oldalign);
end
else
begin
grid1.canvas.textrect(rect,rect.left+2,rect.top+2,grid1.cells[col,row]);
end;
grid1.canvas.font.style:=grid1.canvas.font.style-[fsbold];
end;
end.