unit Unit1;

interface

uses
  MMSystem,Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  jpeg, ExtCtrls, Buttons,shellApi, StdCtrls;

type
  TForm1 = class(TForm)
    BitBtn2: TBitBtn;
    BitBtn1: TBitBtn;
    Image1: TImage;
    Button_Internet: TBitBtn;
    Timer1: TTimer;
    BitBtn3: TBitBtn;
    Label1: TLabel;
    procedure FormShow(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure Button_InternetClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Label1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure BitBtn2MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure BitBtn1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Button_InternetMouseDown(Sender: TObject;
      Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    procedure BitBtn3Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  procedure WMNCHITTEST(var Mes:Tmessage); Message WM_NCHITTEST;
  end;

var
  Form1: TForm1;
  ClickButton:boolean;
implementation

uses Unit2;

{$R *.DFM}

procedure TForm1.FormShow(Sender: TObject);
var FullRgn, EllRgn, Rgn: HRGN;
    w, h: integer;
begin
  FullRgn := CreateRectRgn(0,0,Width,Height);
  Rgn := CreateRectRgn(0,0,Width,Height);
  w := 25; h := 25;
  EllRgn := CreateEllipticRgn(w,h,Width - w,Height - h);
  CombineRgn(Rgn,Rgn,EllRgn,RGN_DIFF);
  CombineRgn(FullRgn,FullRgn,Rgn,RGN_DIFF);
  SetWindowRgn(Handle,FullRgn,True);
end;

procedure TForm1.WMNCHITTEST(var Mes:Tmessage);
begin
  Mes.Result := HTCAPTION;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
  Close;
end;


procedure TForm1.FormActivate(Sender: TObject);
var rgn, rgn2 :HRGN;
begin
  rgn := CreateRectRgn(0, 0, 41, 41);
  rgn2 := CreateEllipticRgn(5, 5, 37, 37);
  CombineRgn(rgn2, rgn, rgn2, RGN_DIFF);
  CombineRgn(rgn, rgn, rgn2, RGN_DIFF);
  SetWindowRgn(BitBtn1.handle, rgn, true);

  rgn := CreateRectRgn(0, 0, 41, 41);
  rgn2 := CreateEllipticRgn(5, 5, 37, 37);
  CombineRgn(rgn2, rgn, rgn2, RGN_DIFF);
  CombineRgn(rgn, rgn, rgn2, RGN_DIFF);
  SetWindowRgn(BitBtn2.handle, rgn, true);

  rgn := CreateRectRgn(0, 0, 41, 41);
  rgn2 := CreateEllipticRgn(5, 5, 37, 37);
  CombineRgn(rgn2, rgn, rgn2, RGN_DIFF);
  CombineRgn(rgn, rgn, rgn2, RGN_DIFF);
  SetWindowRgn(button_internet.handle, rgn, true);

end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  Close;
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
  application.Minimize;
end;



procedure TForm1.Button_InternetClick(Sender: TObject);
const
 url='www.azanov.nm.ru';
begin
  ShellExecute(Handle, 'open', pChar (Url), '', '', SW_SHOW);

end;



procedure TForm1.FormCreate(Sender: TObject);
begin
  ClickButton:=false;

end;


procedure TForm1.Label1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  ClickButton:=false;

end;

procedure TForm1.BitBtn2MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
PlaySound('Switch2.wav',1,snd_async);
end;

procedure TForm1.BitBtn1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
PlaySound('Switch2.wav',1,snd_async);
end;

procedure TForm1.Button_InternetMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
PlaySound('Switch2.wav',1,snd_async);
end;

procedure TForm1.BitBtn3Click(Sender: TObject);
begin
  if form2.Visible=true then
  begin
    BitBtn3.Caption:='Открыть панель';
    Form2.visible:=false;
  end
  else
  begin
    BitBtn3.Caption:='Убрать панель';
    Form2.visible:=true;
  end

end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
 form2.Left:=form1.Left;
 form2.top:=form1.top+440;
end;







end.
