Вот метод вертикальной прокрутки в ScrollBox... =)
Код:
type
TForm1 = class(TForm)
ScrollBox1: TScrollBox;
Image1: TImage;
// ...............
private
{ Private declarations }
procedure WMMOUSEWHEEL(var Msg: TMessage); message WM_MOUSEWHEEL;
public
{ Public declarations }
end;
......................
procedure TForm1.WMMOUSEWHEEL(var Msg: TMessage);
var
zDelta: Integer;
begin
inherited;
if WindowFromPoint(Mouse.CursorPos) <> ScrollBox1.Handle then Exit;
if Msg.WParam < 0 then zDelta := -10 else zDelta := 10;
with ScrollBox1 do
begin
if ((VertScrollBar.Position = 0) and
(zDelta > 0)) or
((VertScrollBar.Position = VertScrollBar.Range - ClientHeight) and
(zDelta < 0)) then Exit;
ScrollBy(0, zDelta);
VertScrollBar.Position := VertScrollBar.Position - zDelta;
end;
end;