unit Unit5;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids,
DB, ADODB;
type
THackGrid=Class( TCustomGrid)
published
property Row;
property TopRow;
property DefaultRowHeight;
property Selection;
End;
TForm5 =
class(TForm)
ADOConnection1: TADOConnection;
ADODataSet1: TADODataSet;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
procedure DBGrid1DrawDataCell(Sender: TObject;
const Rect: TRect;
Field: TField; State: TGridDrawState);
procedure ADODataSet1AfterScroll(DataSet: TDataSet);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form5: TForm5;
implementation
{$R *.dfm}
procedure TForm5.ADODataSet1AfterScroll(DataSet: TDataSet);
begin
ADODataSet1.Tag := (THackGrid(DBGrid1).Row- THackGrid(DBGrid1).TopRow + 1) * (THackGrid(DBGrid1).DefaultRowHeight+1);
DBGrid1.Invalidate;
end;
procedure TForm5.DBGrid1DrawDataCell(Sender: TObject;
const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
if Rect.Top=ADODataSet1.Tag
then
begin
DBGrid1.Canvas.Brush.Color := clred;
DBGrid1.Canvas.Fillrect(rect);
end;
end;
end.