//設置StringGrid1的右對齊(第一欄除外)
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol,ARow: Integer; Rect: TRect; State: TGridDrawState);
var
CellStr: string;
Mode: integer;
begin
if Arow = 0 then Mode := DT_CENTER //第一行标题栏,居中;其它栏居右
else Mode := DT_RIGHT;
CellStr := StringGrid1.Cells[ACol,ARow];
StringGrid1.Canvas.FillRect(Rect);
DrawText(StringGrid1.Canvas.Handle, PChar(CellStr), Length(CellStr), Rect, Mode);
end;