Hola marcial.
Primero que nada, me alegro que el código te haya servido como base
.
Ahora que veo que deseas un scroll continuo con retraso de tiempo, te pongo otra alternativa más simple:
Código Delphi
[-]
procedure TForm1.MMouseEvent(var Msg: TMsg; var Handled: Boolean);
var
P: TPoint;
WControl: TWinControl;
G: TDBGrid;
ZD: Integer;
begin
WControl:= FindVCLWindow(Mouse.CursorPos);
if Assigned(WControl) and (WControl is TDBGrid) then
begin
P:= ScreenToClient(Mouse.CursorPos);
G:= TDBGRid(WControl);
ZD:= GetSystemMetrics(SM_CXVSCROLL);
while (P.X >= G.Left) and (P.X <= G.Left+ZD) do
begin
P:= ScreenToClient(Mouse.CursorPos);
SendMessage(G.Handle, WM_HSCROLL, SB_LINELEFT, 0);
Sleep(250);
end;
while (P.X >= G.Left+G.Width-ZD) and (P.X <= G.Left+G.Width) do
begin
P:= ScreenToClient(Mouse.CursorPos);
SendMessage(G.Handle, WM_HSCROLL, SB_LINERIGHT, 0);
Sleep(250);
end;
end;
end;
Saludos.