procedure TfrmMain.DrawGridDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var Text:String; begin with Sender as TDrawGrid do begin Canvas.Font.Size:=9; Canvas.Font.Color:=clBlue; Text:='要写的字'; Canvas.TextOut(Rect.Left,Rect.Top,Text);//写字 end; end;
Rect: TRect; State: TGridDrawState);
var
Text:String;
begin
with Sender as TDrawGrid do
begin
Canvas.Font.Size:=9;
Canvas.Font.Color:=clBlue;
Text:='要写的字';
Canvas.TextOut(Rect.Left,Rect.Top,Text);//写字
end;
end;
Rect: TRect; State: TGridDrawState);
var
CardNoStr:String[17];
begin
DrawGrid1.Canvas.Brush.Color := clWhite
DrawGrid1.Canvas.FillRect(Rect);
CardNoStr := 'aaa';
DrawGrid1.Canvas.TextOut(Rect.Left, Rect.Top, CardNoStr);
DrawGrid1.Update;
end;