type
TDBGrid=class(DBGrids.TDBGrid)
protected
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
end;
procedure TDBGrid.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
i,Row1,Row2:integer;
begin
if (ssShift in Shift) and (dgMultiSelect in Options) and Datalink.Active then
begin
BeginUpdate;
try
Row1:=Row;
Row2:=MouseCoord(X,Y).Y;
if Row1〈 Row2 then
for i:=Row1+1 to Row2 do
begin
Datalink.DataSet.MoveBy(1);
SelectedRows.CurrentRowSelected := True;
end
else
for i:=Row1-1 downto Row2 do
begin
Datalink.DataSet.MoveBy(-1);
SelectedRows.CurrentRowSelected := True;
end;
finally
EndUpdate;
end;
end
else
inherited MouseDown(Button,Shift,X,Y);
end;