//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "VertScrollBar.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: VertScrollBar
// Property: Forms.TScrollingWinControl.VertScrollBar
// Property: Forms.TControlScrollBar.Increment
// Property: Forms.TControlScrollBar.Position
// Property: Forms.TControlScrollBar.Range
// Property: Forms.TControlScrollBar.Visible
// Property: Controls.TControl.ClientHeight

// BeginCode
/*
The following example demonstrates form scrolling with the
PgUp and PgDn keys.
*/
void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key,
      TShiftState Shift)
{
  const int iPageDelta = 10;

  if (Key == VK_NEXT)
    VertScrollBar->Position += iPageDelta;
  else if (Key == VK_PRIOR)
    VertScrollBar->Position -= iPageDelta;
}
// EndCode
// EndExample: VertScrollBar
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  ClientHeight = 300;
  // 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
  VertScrollBar->Range = 600;
  VertScrollBar->Position = VertScrollBar->Range - ClientHeight; // start form out fully scrolled
  VertScrollBar->Visible = True;  // Show the scrollbar
}
//---------------------------------------------------------------------------

