Top

 Home |
Registrazione Login

 Navigazione : Categoria : GUI
   API ( 10 )
   Componenti ( 3 )
   Database - ADO ( 11 )
   Database - Altro ( 2 )
   Database - BDE ( 2 )
   Database - SQL ( 1 )
   GUI ( 12 )
   IDE ( 2 )
   Internet/Intranet ( 6 )
   Object Pascal ( 10 )
   Operazioni sui file ( 21 )
   Report ( 0 )
   Sistema ( 30 )
   VCL ( 14 )
 
 
       
Scheda

 

 

 Visto ( 813 )


Numero ID

 126

Oggetto

 Effetto terremoto su una finestra di Delphi

Inserito il

 18/02/2008

Scade il

 19/03/2008


 Nome  Giuseppe

Cittā

 ----
Cognome  ----

Via

 ----
 E-mail  Casella postale

Provincia

 ----

Tel...

 ----

Cap

 ----
 Difficolta'   6

Home

 ----
Foto  ----  

Ecco una semplice procedura che consente di "shakerare" una finestra di Delphi ottenendo un effetto simil-terremoto.

~~~~~~~~~~~~~~~~~~~~~~~~~
procedure WindowShake(wHandle: THandle) ;
const
   MAXDELTA = 4;
   SHAKETIMES = 500;
var
   oRect, wRect :TRect;
   deltax : integer;
   deltay : integer;
   cnt : integer;
   dx, dy : integer;
begin
   //ricorda la posizione originale
   GetWindowRect(wHandle,wRect) ;
   oRect := wRect;

   Randomize;
   for cnt := 0 to SHAKETIMES do
   begin
     deltax := Round(Random(MAXDELTA)) ;
     deltay := Round(Random(MAXDELTA)) ;
     dx := Round(1 + Random(2)) ;
     if dx = 2 then dx := -1;
     dy := Round(1 + Random(2)) ;
     if dy = 2 then dy := -1;
     OffsetRect(wRect,dx * deltax, dy * deltay) ;
     MoveWindow(wHandle, wRect.Left,wRect.Top,wRect.Right - wRect.Left,wRect.Bottom - wRect.Top,true) ;
   end;
   //ritorna alla posizione originale
   MoveWindow(wHandle, oRect.Left,oRect.Top,oRect.Right - oRect.Left,oRect.Bottom - oRect.Top,true) ;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~

Esempio di utilizzo:
WindowShake(Application.MainForm.Handle) ;

 

 Contatto immediato

Contattato ( 0 )

 
 Tramite questo Modulo potrā contattare immediatamente il destinatario
 

Nome   

Cognome   

La sua E-mail   

Oggetto   

Richiesta   

 
 

 

Powered by www.youngportal.it

Copyright 2004 - Youngportal.it - Tutti i diritti riservati