unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, jpeg;

type
  TForm1 = class(TForm)
    Image1: TImage;
        Panel1: TPanel;
    Image2: TImage;
    Image3: TImage;
    procedure FormCreate(Sender: TObject);
    procedure Image2MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Image2MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Image3MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private declarations }
  public
  procedure WMNCHitTest(var M: TWMNCHitTest); message wm_NCHitTest;
    { Public declarations }
  end;

var
  Form1: TForm1;
  Point: array[1..6] of TPoint;
  region: HRGN;
  F1:boolean=False;
implementation

{$R *.dfm}
procedure TForm1.WMNCHitTest(var M: TWMNCHitTest);
begin
  inherited;
  { просто делаем так, что Windows думает, что мы }
  { потащили окно за CaptionBar }
  if M.Result = htClient then M.Result := htCaption;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
Point[1].X:=0;
Point[1].Y:=0;
Point[2].X:=385;
Point[2].Y:=0;
Point[3].X:=444;
Point[3].Y:=58;
Point[4].X:=444;
Point[4].Y:=474;
Point[5].x:=0;
Point[5].Y:=474;
Point[6].Y:=0;
Point[6].Y:=0;
 region :=CreatePolygonRgn(Point,6,1);
SetWindowRgn(Handle, region, TRUE);
Image2.show;
Image3.hide;
 end;
procedure TForm1.Image2MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
Image2.Show;
Image3.Hide;
ShowMessage('ok');
end;



procedure TForm1.Image2MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
Image2.Hide;
Image3.Show;
end;

procedure TForm1.Image3MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
Image2.Show;
Image3.Hide;

end;

end.
