procedure TMainForm.StrGrid_TransDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var Area:TRect;
begin
StrGrid_Trans.Canvas.Font.Assign
(StrGrid_Trans.Font);
with StrGrid_Trans,StrGrid_Trans.Canvas do
begin
FillRect(Rect);
Area:= Rect;
InflateRect(Area, -2, -2);
if (ACol<1) or (ARow=0) then
DrawText(Handle, PChar(Cells[ACol, ARow]),Length(Cells[ACol, ARow]), Area, DT_CENTER)//居中
else
DrawText(Handle, PChar(Cells[ACol, ARow]),Length(Cells[ACol, ARow]), Area, DT_RIGHT);//右对齐
end;
end;
procedure TMainForm.StrGrid_RecvDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var Area:TRect;
begin
StrGrid_Recv.Canvas.Font.Assign
(StrGrid_Recv.Font);
with StrGrid_Recv,StrGrid_Recv.Canvas do
begin
FillRect(Rect);
Area:= Rect;
InflateRect(Area, -2, -2);
if (ACol<1) or (ARow=0) then
DrawText(Handle, PChar(Cells[ACol, ARow]),Length(Cells[ACol, ARow]), Area, DT_CENTER)//居中
else
DrawText(Handle, PChar(Cells[ACol, ARow]),Length(Cells[ACol, ARow]), Area, DT_RIGHT);//右对齐
end;
end;