Chapter 09 - Project ColorKeyHole |
Project Structure
| ColorKeyHole.dpr |
program ColorKeyHole;
uses
Forms,
CkForm in 'CkForm.pas' ,
AlphaForm in 'AlphaForm.pas' ,
PlainForm in 'PlainForm.pas' ;
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.CreateForm(TForm3, Form3);
Application.Run;
end.
| CkForm.pas |
unit CkForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Shape1: TShape;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
uses
AlphaForm, PlainForm;
procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.Show;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i: integer;
begin
Form2.AlphaBlendValue := 100;
Form2.Show;
for i := 100 to 255 do
begin
Form2.AlphaBlendValue := i;
Application.ProcessMessages;
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Form3.Hide;
AnimateWindow (Form3.Handle, 2000, AW_BLEND);
Form3.Show;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Form3.Hide;
AnimateWindow (Form3.Handle, 3000, AW_CENTER);
Form3.Show;
end;
end.
| AlphaForm.pas |
unit AlphaForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
Label1: TLabel;
Edit1: TEdit;
private
public
end;
var
Form2: TForm2;
implementation
end.
| PlainForm.pas |
unit PlainForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm3 = class(TForm)
private
public
end;
var
Form3: TForm3;
implementation
end.
| CkForm.dfm |
object Form1: TForm1
Left = 215
Top = 148
Width = 405
Height = 239
AlphaBlendValue = 200
Caption = 'Color Key Hole'
Color = clBtnFace
TransparentColor = True
TransparentColorValue = clGreen
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Shape1: TShape
Left = 195
Top = 16
Width = 181
Height = 177
Anchors = [akLeft, akTop, akRight, akBottom]
Brush.Color = clGreen
Pen.Style = psClear
Pen.Width = 0
Shape = stCircle
end
object Button1: TButton
Left = 32
Top = 32
Width = 105
Height = 25
Caption = 'Alpha'
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 32
Top = 72
Width = 105
Height = 25
Caption = 'Fade In Alpha'
TabOrder = 1
OnClick = Button2Click
end
object Button3: TButton
Left = 32
Top = 112
Width = 105
Height = 25
Caption = 'Fade In Plain'
TabOrder = 2
OnClick = Button3Click
end
object Button4: TButton
Left = 32
Top = 152
Width = 105
Height = 25
Caption = 'Slide From Center'
TabOrder = 3
OnClick = Button4Click
end
end
| AlphaForm.dfm |
object Form2: TForm2
Left = 562
Top = 214
Width = 310
Height = 228
AlphaBlend = True
AlphaBlendValue = 188
Caption = 'AlphaTest'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 64
Top = 96
Width = 32
Height = 13
Caption = 'Label1'
end
object Button1: TButton
Left = 64
Top = 32
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
end
object Edit1: TEdit
Left = 64
Top = 112
Width = 121
Height = 21
TabOrder = 1
Text = 'Edit1'
end
end
| PlainForm.dfm |
object Form3: TForm3
Left = 504
Top = 356
Width = 354
Height = 237
Caption = 'PlainForm'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
end
|
|