Copyright: (c) Copyright 1996 J J Eksteen


BMPScrollBar unit

BMPScrBr Unit (version 1.10 May 1996)

The BMPScrBr unit contains the declarations for the TBMPScrollbar component.

Please read this copyright message.

When you add a component declared in this unit to a form,

the unit is automatically added to the uses clause of that form's unit.

The following items are declared in the BMPScrBr unit:

Components

TBMPScrollBar

Objects

Types

Constants

Variables

Routines

Exceptions

To see a listing of items declared in this unit including their declarations,

use the ObjectBrower.


CopyRight message

 Copyright & Disclaimer

As I have used quite a few freeware components and other code which have been made available by their various authors I believe it is a good idea to make this small component available as Freeware as well.

However, the normal copyrights and disclaimers apply i.e. I retain copyright and do not accept any responsibility for anything that may go wrong or works differently from the way you think (or I say) they will.  Please note that the help file is not 100% compatible with Delphi 2’s help files.

Source code is available for $10 (U.S.).  Please specify your e-mail address when ordering.

Write to:
Jaco Eksteen
P O Box 6206
Pretoria
0001
South Africa

or contact me at
jeksteen@icon.co.za

Version History:
1.0 (Aug 95)
Original TBMPScrollbar
1.1 (May 96)
Fixed bug which caused GPF when a BMP property is cleared.
Changed Paint method to display component name when no Bitmaps are loaded.


TBMPScrollbar component

TBMPScrollBar Component	(Copyright)

Properties               Methods               Events

Unit

BMPScrBr

Description

The TBMPScrollBar component is a descendant of TCustomControl and is intended as a replacement for TScrollbar.  This help page only displays properties, methods and events which are new in TBMPScrollBar.

TBMPScrollbar defines four new bitmap properties which are used to define the appearance of the scrollbar.  Use BMPBottomRight to set the down or right pointing arrow.  Set BMPThumb to define the thumb which slides in the scrollbar’s track.  The BMPTrack property is the bitmap which defines the track of the scrollbar while BMPTopLeft is used to define the look of the up or left pointing arrow.

If the Kind property is sbVertical the total height of the scrollbar is the combined heights of the BMPTrack, BMPBottomRight and BMPTopLeft bitmaps. If the Kind property is sbHorizontal the total width of the scrollbar is the combined widths of the BMPTrack, BMPBottomRight and BMPTopLeft bitmaps.

Another new property is the AutoSize property which, if true, re-sizes the control so that it’s bitmap components are not stretched when displayed.

The other properties are the same as for the TScrollBar and TCustomControl components.  Also no additional Methods or Events have been added.


TBMPScrollBar properties

Properties

 Run-time only               [image] Key properties

AutoSize	BMPBottomRight

BMPThumb	BMPTopLeft

BMPTrack

For other properties see TScrollbar.


TBMPScrollBar methods

Methods

No new methods have been added.  See TScrollbar for method information.


TBMPScrollBar events

Events

 Key events

OnChange

For other events see TScrollbar.


TBMPScrollbar AutoSize property

AutoSize Property

Example

Applies to

TBMPScrollBar component

Declaration

property AutoSize: Boolean;

Description

The AutoSize property controls whether the scrollbar is displayed in the original size of it’s bitmap properties.


TBMPScrollbar BMPBottomRight property

BMPBottomRight Property

Example

Applies to

TBMPScrollBar component

Declaration

property BMPBottomRight: TBitmap;

Description

The BMPBottomRight property refers to a TBitmap object which defines the appearance of the down pointing arrow if Kind is sbVertical and the right pointing arrow if Kind is sbHorizontal.


TBMPScrollBar BMPTopLeft property

BMPTopLeft Property

Example

Applies to

TBMPScrollBar component

Declaration

property BMPTopLeft: TBitmap;

Description

The BMPTopLeft property refers to a TBitmap object which defines the appearance of the up pointing arrow if Kind is sbVertical and the left pointing arrow if Kind is sbHorizontal.


TBMPScrollBar BMPThumb property

BMPThumb Property

Example

Applies to

TBMPScrollBar component

Declaration

property BMPThumb: TBitmap;

Description

The BMPThumb property defines the visual appearance of the area which is displayed on top of the BMPTrack bitmap, between the BMPTopLeft and the BMPBottomRight bitmaps.  The thumb is the area that indicates the relative position in the range which the scrollbar is defined for.


TBMPScrollBar BMPTrack property

BMPTrack Property

Example

Applies to

TBMPScrollBar component

Declaration

property BMPTrack: TBitmap;

Description

The BMPTrack property defines the visual appearance of the area which is displayed between the BMPTopLeft and the BMPBottomRight bitmaps.  The BMPThumb bitmap is displayed on top of this area.


TBMPScrollBar OnChange event

OnChange Event

Example

Applies to

TBMPScrollBar component

Declaration

property OnChange: TNotifyEvent;

Description

The OnChange event is fired whenever the value of the Position property changes.


TBMPScrollbar example

Example

This example demonstrates how the BMPTopLeft, BMPBottomRight, BMPThumb and BMPTrack properties can be set at runtime with Object Pascal code.

procedure TForm1.Button1Click(Sender: TObject);

var

  Bmp: TBitmap;

begin

  try

    Bmp := TBitmap.Create;

    Bmp.LoadFromFile(‘UpArrow.Bmp’);

    BMPScrollBar1.BMPTopLeft := Bmp;

    Bmp.LoadFromFile(‘DnArrow.Bmp’);

    BMPScrollBar1.BMPBottomRight := Bmp;

    Bmp.LoadFromFile(‘Track.Bmp’);

    BMPScrollBar1.BMPTrack := Bmp;

    Bmp.LoadFromFile(‘Thumb.Bmp’);

    BMPScrollBar1.BMPThumb := Bmp;

  finally

    Bmp.Free;

  end;

end;


TBMPScrollbar AutoSize example

Example

This example demonstrates how the AutoSize property can be set at runtime with Object Pascal code.

procedure TForm1.CheckBox1Click(Sender: TObject);

begin

  BMPScrollBar1.AutoSize := CheckBox1.Checked;

end;


TBMPScrollBar OnChange example
Example

This example demonstrates how the OnChange event can be used to track the scrollbar’s status.

procedure TForm1.BMPScrollBar1Change(Sender: TObject);

begin

  Label1.Caption := IntToStr(BMPScrollBar1.Position);

end;