unit AnchForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
BtnClose: TButton;
BtnShow: TButton;
ListBox1: TListBox;
procedure BtnShowClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BtnCloseClick(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
procedure TForm1.BtnShowClick(Sender: TObject);
begin
ShowMessage (ListBox1.Items [ListBox1.ItemIndex]);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ListBox1.ItemIndex := 0;
end;
procedure TForm1.BtnCloseClick(Sender: TObject);
begin
Close;
end;
end.
|
object Form1: TForm1
Left = 192
Top = 107
Width = 288
Height = 226
Caption = 'Anchors'
Color = clBtnFace
Constraints.MinHeight = 150
Constraints.MinWidth = 250
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = 'Arial'
Font.Style = [fsBold]
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 18
object BtnClose: TButton
Left = 188
Top = 165
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = 'Close'
TabOrder = 0
OnClick = BtnCloseClick
end
object BtnShow: TButton
Left = 188
Top = 133
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = 'Show'
TabOrder = 1
OnClick = BtnShowClick
end
object ListBox1: TListBox
Left = 16
Top = 8
Width = 154
Height = 182
Anchors = [akLeft, akTop, akRight, akBottom]
ItemHeight = 18
Items.Strings = (
'one'
'two'
'three'
'four'
'five'
'six'
'seven'
'eight')
TabOrder = 2
end
end
|