Delphi: AutoSize property resizes a container (panel, scrollbox, form, frame…) to grow it to fit all controls

  

A while back I needed a design-time way to automatically resize a Delphi container control (descendants from the, [WayBack] TWinControl Class like [WayBack] TPanel, [WayBack] TScrollbox, [WayBack] TForm, [WayBack] TFrame) to grow/shrink so it just fits around it’s contained controls.
Back then I needed it for VCL design time, if possible taking into account non-visual components.
The [WayBack] TControl.AutoSize Property does just that for visual controls and works way better than suggestions on doing this manually.
Manually adjusting many controls at design time is a tedious job, especially when trying to prevent mouse usage (I’ve had RSI in the early 1990s, so I’m extra careful).
Thanks Uwe Raabe for helping me out on this.
I’ve not had the need for non-visual components or FMX yet, but if I ever need it, then this piece of code by Stefan Glienke might work:
[Archive.is] [Delphi] ResizeControlEditor – Pastebin.com
–jeroen
Source: [WayBack] Is there an expert that can resize a container (panel, scrollbox, form, frame, etc) to be just large enough so it fits all it components?So: grow when… – Jeroen Wiert Pluimers – Google+

https://pastebin.com/vT0FnRPN
 
 

Comments are closed.