Marco Web Center |
Home: Code Repository: Mastering Delphi 5Project ANCHORS
Project StructureANCHORS.DPRprogram Anchors; uses Forms, AnchForm in 'AnchForm.pas' {Form1}; {$R *.RES} begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. ANCHFORM.PASunit 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 { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.BtnShowClick(Sender: TObject); begin ShowMessage (ListBox1.Items [ListBox1.ItemIndex]); end; procedure TForm1.FormCreate(Sender: TObject); begin // select the first item ListBox1.ItemIndex := 0; end; procedure TForm1.BtnCloseClick(Sender: TObject); begin Close; end; end. ANCHFORM.DFMobject 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
|
||
© Copyright Marco Cantù, 1995-2020, All rights reserved |