prevent scaling of child controls

From: Stephan Steiner (steiner_at_isuisse.com)
Date: 03/27/05


Date: Sun, 27 Mar 2005 17:00:22 +0200

Hi

I have a form that I need to programmatically resize at runtime. The form is
not user resizable so that's one less problem to take care off, but still
I'm having some problems:

I have a picturebox, which determines the size of the form. Its initial size
doesn't matter, but upon loading the form, I load an image which determines
the size of the picturebox, and thus the entire form (it also has a slider
and a few buttons). I know the relative sizes of each GUI element with
respect to that picturebox - the problem is that I can't set the .Size of
any element so I have to call scale, and calling scale on the form scales
all child controls, including some that should not be scaled (buttons). I
tried putting the controls I don't want to be resized into a panel and set
its Locked property to true, but that doesn't prevent the panel elements
from being resized. So I'm wondering, is there a better way than scaling the
form, then scaling child elements back to have the size I actually want them
to have? Is there a way to make scale only scale the form and none of the
associated controls so that after resizing the form I could call scale on
the controls that I need to resize?

Regards
Stephan


Quantcast