Marco Web Center |
|
Chapter 02 - Project Createc |
Project Structure |
Createc.dpr |
program CreateC; uses Forms, CreateCF in 'CreateCF.pas' {Form1}; {$R *.RES} begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. |
CreateCF.pas |
unit CreateCF; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms; type TForm1 = class(TForm) procedure FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} uses StdCtrls; procedure TForm1.FormMouseDown( Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var Btn: TButton; begin Btn := TButton.Create (Self); Btn.Parent := Self; Btn.Left := X; Btn.Top := Y; Btn.Width := Btn.Width + 50; Btn.Caption := Format ('Button at %d, %d', [X, Y]); end; end. |
CreateCF.dfm |
object Form1: TForm1 Left = 230 Top = 109 Width = 353 Height = 306 Caption = 'Create Comp' Color = clBtnFace Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = True OnMouseDown = FormMouseDown PixelsPerInch = 96 TextHeight = 13 end |