type
TMyDBGrid = class(TDBGrid);
procedure DemoDrawColumnCell(
Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
with TMyDBGrid(Sender) do
begin
if DataLink.ActiveRecord = Row - 1 then
begin
Canvas.Brush.Color := $00FBF0E6;
Canvas.Font.Color := clBlack;
end else begin
Canvas.Brush.Color := Color;
Canvas.Font.Color := Font.Color;
end;
DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
end;
博客给出了TMyDBGrid类的定义及DemoDrawColumnCell过程代码。该过程用于绘制列单元格,根据活动记录状态设置画布的背景色和字体颜色,最后调用DefaultDrawColumnCell完成绘制。
1071

被折叠的 条评论
为什么被折叠?



