Mega Code Archive

 
Categories / Delphi / Forms
 

Reduce a form by right-clicking on the titlebar

type TForm1 = class(TForm) private { Private-Deklarationen } FOldHeight: Integer; procedure WMNCRButtonDown(var Msg: TWMNCRButtonDown); message WM_NCRBUTTONDOWN; public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.WMNCRButtonDown(var Msg: TWMNCRButtonDown); begin if (Msg.HitTest = HTCAPTION) then if (ClientHeight = 0) then begin ClientHeight := FOldHeight; Application.ProcessMessages; end else begin FOldHeight := ClientHeight; ClientHeight := 0; Application.ProcessMessages; end end;