Minimizate controls in your form  

Send By: Radikal (Q3 Team)
Web : http://www.q3.nu
Email: radikal@q3.nu
Date: 04/02/00

Tip accessed 54 times

 


This more than a trick... it is a curiosity.
All the Delphi controls derived of TWinControl, for Windows are not more than windows.
Keeping this in mind... what happens if for example, we minimizate a TMemo or a TButton?

Test it and you will see it:

  • Put a TMemo (memo1) and a TButton in your form
  • Put this code in the OnClick of the TButton:


     procedure TForm1.Button3Click(Sender: TObject);
     begin
       CloseWindow(Memo1.Handle);
     end;
    





    Minimizing a control in your form, in a given X, Y coordinates




     procedure TForm1.Button1Click(Sender: TObject);
    
       Procedure MinimizaEn(Que:THandle;X,Y:integer);
       var
         Posiciones: TWindowPlacement;
       begin
         Posiciones.length:=SizeOf(Posiciones);
         GetWindowPlacement(Que,@Posiciones);
         Posiciones.flags:=WPF_SETMINPOSITION;
         Posiciones.ptMinPosition.x:=X;
         Posiciones.ptMinPosition.y:=Y;
         SetWindowPlacement(Que,@Posiciones);
         CloseWindow(Que);
       end;
    
     begin
       MinimizaEn(Memo1.Handle,20,30);
     end;
    




    Updated at 04/02/2000