prevent scaling of child controls

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

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



Relevant Pages

  • Re: Forms and resolution independent display
    ... However I really would like to scale or resize the controls as well. ... It does not stretch to fill ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: resizing controls on the fly
    ... No self-sizing controls. ... "resizing controls" that you just plop on a form and they attempt to resize ... have to do is move the container as appropriate. ... designing at a high resolution and having to scale down ...
    (microsoft.public.vb.controls)
  • Re: Question about User Form Window Size on Chip Petersons Site
    ... going to do the requisite resizing and/or repositioning the controls ... these controls will not move or resize themselves ... higher res screens alone. ... but the Main Window the Form located is in is still bigger than ...
    (microsoft.public.excel.programming)
  • Re: Scaling a Window
    ... >> clicked using the WindowFromPoint API function. ... you could then run your resize code. ... >in resizing the window, the window won't KNOW that it's been resized. ... >controls are hidden due to this then they'll still function (assuming the ...
    (microsoft.public.vb.general.discussion)
  • Re: Redrawing a region??
    ... Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As ... 'Do resize ... E.g. some controls may be not properly redrawn after that, ...
    (microsoft.public.vb.winapi)