this slowpoke moves

Create Screen Shaker

var
   Form1: TForm1;
   Fond : TBitmap;
   
//

Procedure CaptureEcran(Bmp :TBitMap);
var
 c :TCanvas;
 r :TRect;
begin
   c := TCanvas.Create;
   c.Handle := GetWindowDC (GetDesktopWindow);
     try
      r := Rect(0,0,screen.width,screen.height);
      Bmp.Width := screen.Width;
      Bmp.Height := screen.Height;
      Bmp.Canvas.CopyRect(r, c, r);
     finally
      ReleaseDC(0, c.handle);
      c.Free;
     end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
   Fond := TBitMap.Create;
   CaptureEcran(Fond);
   Form1.Brush.Bitmap := Fond;
   SetWindowPos(Form1.handle, HWND_TOPMOST, 0,0,width, height,SWP_NOMOVE);
   Timer1.Enabled := True;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
  begin
   Fond.Free;
end;

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
  begin
   if key = 27 then close;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
 var x, y:integer;
  begin
   randomize;
   x := random(5);
   y := random(5);
   left := x;
   top := y;
 end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate