The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,512 other followers

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

Posted by jpluimers on 2018/12/26

A while back I needed a design-time way to automatically resize a Delphi container control (descendants from the, [WayBackTWinControl 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 [WayBackTControl.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

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: