stringgrid:
1. 建立底纹的bitmap.
2. defaultdrawing := false;
3. 在OnDrawCell事件中写代码:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if state <> [] then // selected or focused or fixed cell
begin
......
end
else begin
stringgrid1.canvas.brush.style := bsClear;
stringgrid1.canvas.copyrect(rect, Backgroundbitmap.canvas, rect); //画cell部分的背景
stringgrid1.canvas.textrect(rect, rect.left + 2, rect.top + 2, stringgrid1.cells[acol, arow]);
end;
end;
dbgrid:
1. 相同
2. 相同
3. OnDrawColumnCell: