ScrollBarIncrement (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example starts the form in a position scrolled so that the right hand edge shows.

Code

procedure TForm1.FormCreate(Sender: TObject);
begin
  ClientWidth := 300;
  with HorzScrollBar do
  begin
    { Set the range to twice the ClientWidth of the form. }
    { This means that the form's logical size is twice as big }
    { as the physical window. }
    { Note that Range must always be larger than the ClientWidth. }
    Range := 600; 
    Position := Range - ClientWidth; { Start form out fully scrolled. }
    Increment := 10;  { Clicking the scroll arrows moves the form 10 pixels. }
    Visible := True;  { Show the scrollbar. }
  end;
end;

Uses