IMouseStartPan (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example uses a scroll box (TScrollBox) and two labels placed on it in two different positions, one visible and one not. To see the hidden label, right-click the scroll box. A panning window appears, allowing you to scroll the box and see the label.

Code

procedure TForm1.ScrollBox1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  { Verify whether the right mouse button is pressed. If yes, start panning. }
  if Button = mbLeft then
    IMouse.StartPan(ScrollBox1.Handle, ScrollBox1);
end;

Uses