whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

82 Visitors Online


 
...close a form animated?
Autor: erwan pujianto
[ Print tip ]  

Tip Rating (8):  
     


var
  
tutup: Boolean;
  i: Integer;

procedure TForm1.Timer1Timer(Sender: TObject);
var
  
reg1, reg2: hrgn;
begin
  if 
tutup = True then
  begin
    
i := i + 10;
    reg1 := CreateRoundRectRgn(0 + i, 0 + i, Width - i, Height - i, 20, 20);
    SetWindowRgn(Handle, reg1, True);
  end;

  if i >= Width then
  begin
    
tutup := False;
    i := 1;
  end;

  if tutup = False then
  begin
    
i := i + 10;
    reg1 := CreateRectRgn(0, 0, (Width div 2) - i, Height);
    reg2 := CreateRectRgn((Width div 2) + i, 0, Width, Height);
    CombineRgn(reg1, reg1, reg2, rgn_or);
    SetWindowRgn(Handle, reg1, True);
    if i >= Width div then
    begin
      
tutup := True;
      i := 1;
    end;
  end;
end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
var
  
reg1: hrgn;
begin
  
i := 1;
  timer1.Enabled := True;
  if MessageDlg('Exit now ?',
    mtConfirmation, [mbYes, mbNo], 0) = mrYes then
    
CanClose := True
  else
  begin
    
CanClose := False;
    timer1.Enabled := False;
    reg1 := CreateRoundRectRgn(0, 0, Width, Height, 0, 0);
    SetWindowRgn(Handle, reg1, True);
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  
tutup := True;
  timer1.Enabled := False;
end;


 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners