Ian Branch 127 Posted July 7, 2020 Hi Team, Can I allow a Form to resize vertically only, not horizontally at all? If so, how please? Regards & TIA, Ian Share this post Link to post
haentschman 92 Posted July 7, 2020 (edited) Hi... TForm.Contraints are your friends. http://docwiki.embarcadero.com/Libraries/Seattle/en/Vcl.Controls.TControl.Constraints Edited July 7, 2020 by haentschman Share this post Link to post
Ian Branch 127 Posted July 7, 2020 Ah Ha! Tks haentschman. I have never used constraints. I shall have a play. Share this post Link to post
Uwe Raabe 2057 Posted July 7, 2020 There is also an OnConstrainedResize event. 1 Share this post Link to post
David Heffernan 2345 Posted July 7, 2020 In addition to constraining the window's size, you should consider giving the user visual feedback for their attempts to resize. Do this by handling the WM_NCHITTEST message: https://docs.microsoft.com/en-gb/windows/win32/inputdev/wm-nchittest type TForm1 = class(TForm) protected procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST; end; .... procedure TForm1.WMNCHitTest(var Message: TWMNCHitTest); begin inherited; case Message.Result of HTLEFT,HTRIGHT: Message.Result := HTCAPTION; HTTOPLEFT,HTTOPRIGHT: Message.Result := HTTOP; HTBOTTOMLEFT,HTBOTTOMRIGHT: Message.Result := HTBOTTOM; end; end; 2 Share this post Link to post