«« Site Rescued »»

While the site is still going to move from its current host, a new site will now take its place. More Info.

The new site may have less content, but the core will now remain. And it will now play nicely with phones! Keep an eye on the DelphiDabbler Blog for news.

» Help

How to minimize the controls in a form

   

This more than a trick... it is a curiosity.

All the Delphi controls derived from TWinControl are no more than windows. Keeping this in mind what happens if for example, we minimize a TMemo or a TButton?

Test it and you will see. Put a TMemo and a TButton on your form. Then put this code in the OnClick event handler of the TButton:

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

Here is how to minimize a control on your form at given X,Y coordinates:

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;
Author: Unknown
Contributor: geotech
Added: 2010-12-17
Last updated: 2010-12-17

« Return to contents »