Chapter 09 - Project Scroll1 |
Project Structure
| Scroll1.dpr |
program Scroll1;
uses
Forms,
ScrollF in 'ScrollF.pas' ,
StatusF in 'StatusF.pas' ;
begin
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TStatus, Status);
Application.Run;
end.
| ScrollF.pas |
unit ScrollF;
interface
uses
Windows, Classes, Graphics, Forms, Controls,
StdCtrls, SysUtils, Messages, Statusf;
type
TForm1 = class(TForm)
ListBox1: TListBox;
ListBox2: TListBox;
ListBox3: TListBox;
ListBox4: TListBox;
ListBox5: TListBox;
ListBox6: TListBox;
procedure FormResize(Sender: TObject);
private
public
procedure FormScroll (var ScrollData: TWMScroll); message wm_HScroll;
end;
var
Form1: TForm1;
implementation
procedure TForm1.FormResize(Sender: TObject);
begin
Status.Label3.Caption := IntToStr(ClientWidth);
Status.Label4.Caption := IntToStr(HorzScrollBar.Position);
end;
procedure TForm1.FormScroll (var ScrollData: TWMScroll);
begin
inherited;
Status.Label3.Caption := IntToStr(ClientWidth);
Status.Label4.Caption := IntToStr(HorzScrollBar.Position);
end;
end.
| StatusF.pas |
unit StatusF;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls;
type
TStatus = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
private
public
end;
var
Status: TStatus;
implementation
end.
| ScrollF.dfm |
object Form1: TForm1
Left = 213
Top = 101
Width = 458
Height = 368
HorzScrollBar.Range = 1000
VertScrollBar.Range = 305
ActiveControl = ListBox1
AutoScroll = False
Caption = 'Scrolling Form'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'System'
Font.Style = []
OldCreateOrder = True
OnResize = FormResize
PixelsPerInch = 96
TextHeight = 16
object ListBox1: TListBox
Left = 44
Top = 112
Width = 137
Height = 193
ItemHeight = 16
Items.Strings = (
'a'
'b'
'c'
'd'
'e'
'f'
'g'
'h'
'i'
'j'
'k'
'l'
'm'
'n'
'o'
'p'
'q')
TabOrder = 0
end
object ListBox2: TListBox
Left = 196
Top = 80
Width = 137
Height = 201
ItemHeight = 16
Items.Strings = (
'AA'
'BB'
'CC'
'DD'
'EE'
'FF'
'GG'
'HH'
'II'
'JJ'
'KK'
'LL'
'MM'
'NN'
'OO'
'PP'
'QQ')
TabOrder = 1
end
object ListBox3: TListBox
Left = 348
Top = 32
Width = 137
Height = 233
ItemHeight = 16
Items.Strings = (
'1'
'2'
'3'
'4'
'5'
'6'
'7'
'8'
'9'
'10'
'11'
'12'
'13'
'14'
'15'
'16'
'17'
'18'
'19'
'20')
TabOrder = 2
end
object ListBox4: TListBox
Left = 504
Top = 32
Width = 153
Height = 249
ItemHeight = 16
Items.Strings = (
'ONE'
'TWO'
'THREE'
'FOUR'
'FIVE'
'SIX'
'SEVEN'
'EIGHT'
'NINE'
'TEN')
TabOrder = 3
end
object ListBox5: TListBox
Left = 680
Top = 32
Width = 129
Height = 241
ItemHeight = 16
Items.Strings = (
'236'
'568'
'234'
'769'
'567'
'345'
'234'
'123'
'523'
'754'
'987'
'978'
'654'
'543'
'432'
'321'
'353'
'565'
'785'
'673'
'584'
'784'
'385'
'484'
'')
TabOrder = 4
end
object ListBox6: TListBox
Left = 832
Top = 32
Width = 145
Height = 201
ItemHeight = 16
Items.Strings = (
'QW'
'ER'
'TY'
'UI'
'OP'
'LK'
'JH'
'GF'
'DS'
'AZ'
'XC'
'VB'
'NM')
TabOrder = 5
end
end
| StatusF.dfm |
object Status: TStatus
Left = 191
Top = 147
BorderIcons = [biSystemMenu]
BorderStyle = bsToolWindow
Caption = 'Status'
ClientHeight = 47
ClientWidth = 189
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'System'
Font.Style = []
FormStyle = fsStayOnTop
OldCreateOrder = True
Visible = True
PixelsPerInch = 96
TextHeight = 16
object Label1: TLabel
Left = 8
Top = 8
Width = 90
Height = 16
Caption = 'Form Size (x):'
end
object Label2: TLabel
Left = 8
Top = 24
Width = 118
Height = 16
Caption = 'Scroll Position (x):'
end
object Label3: TLabel
Left = 136
Top = 8
Width = 44
Height = 16
Caption = 'Label3'
end
object Label4: TLabel
Left = 136
Top = 24
Width = 44
Height = 16
Caption = 'Label4'
end
end
|
|