unit WinForm;

interface

uses
  System.Drawing, System.Collections, System.ComponentModel,
  System.Windows.Forms, System.Data;

type
  TWinForm = class(System.Windows.Forms.Form)
  {$REGION 'Designer Managed Code'}
  strict private
    /// <summary>
    /// Required designer variable.
    /// </summary>
    Components: System.ComponentModel.Container;
    Label1: System.Windows.Forms.Label;
    Button1: System.Windows.Forms.Button;
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    procedure InitializeComponent;
    procedure TWinForm_Paint(sender: System.Object; e: System.Windows.Forms.PaintEventArgs);
    procedure Button1_Click(sender: System.Object; e: System.EventArgs);
    procedure TWinForm_Closing(sender: System.Object; e: System.ComponentModel.CancelEventArgs);
    procedure TWinForm_KeyPress(sender: System.Object; e: System.Windows.Forms.KeyPressEventArgs);
  {$ENDREGION}
  strict protected
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    procedure Dispose(Disposing: Boolean); override;
  private
  klawiszX, klawiszY: Integer;
  CzyKlawiszMyszkiPrzycisniety: Boolean;
 // kol: Color;
    { Private Declarations }
  public
    constructor Create;
  end;

  [assembly: RuntimeRequiredAttribute(TypeOf(TWinForm))]

implementation

{$AUTOBOX ON}

{$REGION 'Windows Form Designer generated code'}
/// <summary>
/// Required method for Designer support -- do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure TWinForm.InitializeComponent;
begin
  Self.Label1 := System.Windows.Forms.Label.Create;
  Self.Button1 := System.Windows.Forms.Button.Create;
  Self.SuspendLayout;
  // 
  // Label1
  // 
  Self.Label1.BackColor := System.Drawing.Color.Blue;
  Self.Label1.Font := System.Drawing.Font.Create('Microsoft Sans Serif', 15.75, 
      System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (Byte(238)));
  Self.Label1.ForeColor := System.Drawing.Color.Yellow;
  Self.Label1.Location := System.Drawing.Point.Create(24, 175);
  Self.Label1.Name := 'Label1';
  Self.Label1.Size := System.Drawing.Size.Create(432, 33);
  Self.Label1.TabIndex := 0;
  Self.Label1.Text := 'Windows Forms - Delphi for .NET';
  // 
  // Button1
  // 
  Self.Button1.ForeColor := System.Drawing.Color.Red;
  Self.Button1.Location := System.Drawing.Point.Create(416, 56);
  Self.Button1.Name := 'Button1';
  Self.Button1.Size := System.Drawing.Size.Create(28, 27);
  Self.Button1.TabIndex := 1;
  Self.Button1.Text := 'X';
  Include(Self.Button1.Click, Self.Button1_Click);
  // 
  // TWinForm
  // 
  Self.AutoScale := False;
  Self.AutoScaleBaseSize := System.Drawing.Size.Create(6, 15);
  Self.BackColor := System.Drawing.Color.Black;
  Self.ClientSize := System.Drawing.Size.Create(700, 551);
  Self.Controls.Add(Self.Button1);
  Self.Controls.Add(Self.Label1);
  Self.FormBorderStyle := System.Windows.Forms.FormBorderStyle.None;
  Self.Name := 'TWinForm';
  Self.Text := 'WinForm';
  Self.TransparencyKey := System.Drawing.Color.Black;
  Include(Self.Closing, Self.TWinForm_Closing);
  Include(Self.KeyPress, Self.TWinForm_KeyPress);
  Include(Self.Paint, Self.TWinForm_Paint);
  Self.ResumeLayout(False);
end;
{$ENDREGION}

procedure TWinForm.Dispose(Disposing: Boolean);
begin
  if Disposing then
  begin
    if Components <> nil then
      Components.Dispose();
  end;
  inherited Dispose(Disposing);
end;

constructor TWinForm.Create;
begin
  inherited Create;
  //
  // Required for Windows Form Designer support
  //
  InitializeComponent;
  //
  // TODO: Add any constructor code after InitializeComponent call
  //
end;

procedure TWinForm.TWinForm_KeyPress(sender: System.Object; e: System.Windows.Forms.KeyPressEventArgs);
begin
  if e.KeyChar=Chr(27) then Close;
end;

procedure TWinForm.TWinForm_Closing(sender: System.Object; e: System.ComponentModel.CancelEventArgs);
var wartosc,krok: real;
begin
wartosc:=1.0;
krok:=0.01;
repeat
  Opacity:=wartosc;
  wartosc:=wartosc-krok;
until wartosc<krok;

end;

procedure TWinForm.Button1_Click(sender: System.Object; e: System.EventArgs);
begin
Close;
end;

procedure TWinForm.TWinForm_Paint(sender: System.Object; e: System.Windows.Forms.PaintEventArgs);
var  bit: Bitmap;
begin
  bit:=Bitmap.Create('tmp.bmp');
  bit.MakeTransparent(backColor);
  e.Graphics.DrawImage(bit,0,0);
end;

end.
