ScrollBarIncrement (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

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

Code

__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
  /* Set the width of the form window to display 300 pixels in the client area. */
  ClientWidth = 300;
  /* Now set the range to twice the client width.
   This means that the form has a logical size
   that is twice as big as the physical window.
   Note that Range must always be at least as big as ClientWidth. */
  HorzScrollBar->Range = 600;
  /* Start the form fully scrolled. */
  HorzScrollBar->Position = HorzScrollBar->Range - ClientWidth;
  /* Clicking the scroll arrows moves the form 10 pixels. */
  HorzScrollBar->Increment = 10;
  HorzScrollBar->Visible = true;  // Show the scroll bar.
}

Uses