摘要:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);vars: String;R: TRect;beginwith StringGrid1 dobeginif ARow=0 then Canvas.Font.Color := clWhite;if ACol=0 then Canvas.Font.Color := clWhite;if Cells[ACol,ARow] = '变色' then //找到内容为'变色'的单元格 阅读全文
摘要:
在OnDrawCell中加入如下代码:procedure TForm1.Stringgrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);begin with Sender as TStringGrid do begin Canvas.FillRect(Rect); DrawText(Canvas.Handle, Pchar(Cells[ACol, ARow]), Length(Cells[ACol, ARow]), Rect, DT_CENTER or DT_SINGLE 阅读全文