|
VCL Form, A_bout
Create VCL Form - A_bout
Classes used in this Form: Windows,
Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,
Borland.Vcl.StdCtrls, Borland.Vcl.ExtCtrls,
System.ComponentModel;
Type of Controls used in this
Form:
Label, Image, Memo, Panel and Button
- On the File
menu , click New. and then click VCL Form.
New File name Unit1.pas appears. (Form name -
Form1)
- On the View menu ,
click Object Inspector. In
Object Inspector modify the following ...
1- Unit1.pas
|
Old |
New |
File Name: |
Unit1.pas |
A_bout,pas |
|
2.
Form1
|
Old |
New |
Caption: Name: Icon: Menu: Border
Icons
biMaximize: Position: Height: Width: |
Form1 Form1 None (none)
True poDefaultPosOnly 240 347 |
About About TIcon (none)
False poDesKtopcenter
209 401 |
|
Save this file
...
On the File menu ,
click Save
The
codes corresponding to the VCL Form created by system
.... File name - Unit1.pas
unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.nfm}
end. |
|
1. |
The
design, A_bout. |
|
 |
. |
| |
2. |
From the Tool palette add these
controls .. (From the View menu, click Tool
palette) |
|
- Add the TImage control - Image1, Object
inspector:
Name: Picture: Center: Visible: |
Image1 (TBitmap) True True | |
Bitmap file
added =
C:\App-VCLDelphi\Pic\diam1.bmp
- Add the TLabel control - Label1, Object
inspector:
Font: Name: Text: Alignment: |
Times New Roman, 9.75pt,
style=Bold, Italic
Label1 Info ... Left | |
- Add the TLabel control - Label2, Object
inspector:
Font: Name: Text: Alignment: |
Times New Roman, 9.75pt,
style=Bold, Italic Label2 no Copyright
Left | |
- Add the TMemo control - Memo1, Object
inspector:
Border Style: Name:
Color: |
bsNone Memo1
BtnFace | |
- Add the TMemo control - Memo2, Object
inspector:
Border Style: Name:
Color: |
bsNone Memo2
BtnFace | |
- Add the TPanel control - Panel1, Object
inspector:
- Add the TButton control - Button1, Object
inspector:
Caption:
Name: |
Done Button1 | | | |
|
|
The Event and codes in Delphi ... A_bout
The text Code is Navy
color,
corresponding to code create by system The text Code is
red color, corresponding to the code corresponding to the
events added The text Code is Navy
color,
corresponding to the other form to be
add
|
|
unit A_bout;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms,
Dialogs, Borland.Vcl.StdCtrls, Borland.Vcl.ExtCtrls,
System.ComponentModel;
type
TAbout = class(TForm)
Panel2: TPanel;
Button1: TButton;
Label2: TLabel;
Panel1: TPanel;
Memo2: TMemo;
Memo1: TMemo;
Label1: TLabel;
Image1: TImage;
procedure FormActivate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
About: TAbout;
implementation
uses
Mainform, App_DMod;
{$R *.nfm}
procedure TAbout.FormActivate(Sender:
TObject);
begin
// Load Image ...
self.Image1.Picture.LoadFromFile(Main_Form.DataDirectory +
'diam1.bmp');
// StatusBar Panel N1 = Message
Main_Form.StatusBar1.Panels.Items[0].Text := 'Ready ...';
try
AppDMod.Table1.DisableControls;
AppDMod.Database1.Open;
AppDMod.Table1.Active := True;
AppDMod.Table1.First;
while not AppDMod.Table1.EOF do
begin
if (AppDMod.Table1.Fields.Fields[1].Value = '00a') then
self.Memo1.Text := AppDMod.Table1.Fields.Fields[5].Value;
if AppDMod.Table1.Fields.Fields[1].Value = '00b' then
begin
self.Memo2.Text := AppDMod.Table1.Fields.Fields[5].Value;
Exit;
end;
AppDMod.Table1.Next;
end;
finally
AppDMod.Table1.EnableControls;
end;
end;
procedure TAbout.Button1Click(Sender: TObject);
begin
AppDMod.Table1.Close;
AppDMod.Database1.Close;
close;
// StatusBar Panel N1 = Message
Main_Form.StatusBar1.Panels.Items[0].Text := 'Hello ...';
end;
end. |
| |
|
|