Is there a way to suspend all anchored controls on a form from moving or resizing themselves temporarily? i.e.:
procedure ScaleFormBy(AForm: TForm; n, d: Integer); begin AForm.SuspendAnchors(); try AForm.ScaleBy(n, d); finally AForm.ResumeAnchors(); end; end;
I need to do this because I’m calling
AForm.ScaleBy(m, d);
Which does not handle anchored controls properly. (it pushes left+right or top+bottom anchored controls off the edge of the form.
Note: I want to disable Anchors, not Alignment.
Guy had a good idea, but it didn’t handle child control (i.e. TPanel, TPageControl, etc)
Here’s a variant that uses recursion. Also, notice that i don’t actually disable anchors – turn out that ScaleBy doesn’t work with no anchors either.
So now you can scale a form using:
With the support library functions: