procedure TForm1.StringGrid2DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
inherited;
With StringGrid2 Do
Begin
If (ARow = 0) Or (ACol = 0) Then
Canvas.Font.Color := clRed
Else
Canvas.Font.Color := clBlack;
Canvas.Brush.Color := clWhite;
Canvas.TextRect(Rect, Rect.Left + 3, Rect.Top + Trunc((RowHeights[ARow] - 14)/2), Cells[ACol, ARow]);
DrawText(Canvas.Handle,pchar(Cells[Acol,Arow]),Length(Cells[Acol,Arow]),Rect,DT_WORDBREAK or DT_LEFT)
End;
end;
Rect: TRect; State: TGridDrawState);
begin
inherited;
With StringGrid2 Do
Begin
If (ARow = 0) Or (ACol = 0) Then
Canvas.Font.Color := clRed
Else
Canvas.Font.Color := clBlack;
Canvas.Brush.Color := clWhite;
Canvas.TextRect(Rect, Rect.Left + 3, Rect.Top + Trunc((RowHeights[ARow] - 14)/2), Cells[ACol, ARow]);
DrawText(Canvas.Handle,pchar(Cells[Acol,Arow]),Length(Cells[Acol,Arow]),Rect,DT_WORDBREAK or DT_LEFT)
End;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货