if strngrdExcelFiles1.Cells[j, i] <> strngrdExcelFiles2.Cells[j, i] then
begin
with strngrdExcelFiles1 do
begin
str := strngrdExcelFiles1.Cells[j, i];
Rect := strngrdExcelFiles1.CellRect(j, i);
strngrdExcelFiles1.Canvas.Brush.Color := clBlue;
Canvas.FillRect(Rect);
end;
end;我是先赋值给stringgrid然后再进行比对,发现不一样的,通过不同颜色显示出来,现在颜色能显示了,但内容看不到了,是什么原因呢? 在线等啊。
begin
with strngrdExcelFiles1 do
begin
str := strngrdExcelFiles1.Cells[j, i];
Rect := strngrdExcelFiles1.CellRect(j, i);
strngrdExcelFiles1.Canvas.Brush.Color := clBlue;
Canvas.FillRect(Rect);
end;
end;我是先赋值给stringgrid然后再进行比对,发现不一样的,通过不同颜色显示出来,现在颜色能显示了,但内容看不到了,是什么原因呢? 在线等啊。
if strngrdExcelFiles1.Cells[j, i] <> strngrdExcelFiles2.Cells[j, i] then
begin
with strngrdExcelFiles1 do
begin
str := strngrdExcelFiles1.Cells[j, i];
Rect := strngrdExcelFiles1.CellRect(j, i);
strngrdExcelFiles1.Canvas.Brush.Color := clBlue;
Canvas.FillRect(Rect);
strngrdExcelFiles1.Canvas.textrect(Rect,Rect.left,Rect.Top,strngrdExcelFiles1.Cells[j, i]);
end;
end;
用DrawText和strngrdExcelFiles1.Canvas.textrect画都行