Re: Windows Forms: Control.Scale(SizeF) does not work?



WernerG <WernerG@xxxxxxxxxxxxxxxxxxxxxxxxx> writes:

[...]
I have read the link but I am a bit lost in all that, I fail to inderstand
what is causing the Scale to do nothing.
[...]

I had a similar problem understanding Scale. What helped me was
walking through with the debugger. What I found is that the scale is
used one time, the first time the UI is layed out. It is applied to
the dimensions of everything that one time, and their height and width
are set to the new, scaled dimensions instead of what you originally
set them to. Once it has been applied the scaled DPI is set to the
same as the current DPI, so no more scaling will happen.

This works well for UI components that are layed out in the editor,
since they will all be created before the first layout, and so they
will be scaled as you would expect. Components added after this will
not be scaled, though.

After scaling happens, the original components will have their height
and width already adjusted for the screen layout, so you can use those
already-scaled dimensions to calculate the dimensions or location for
a new component. Or, if you really need to use the scaling factor,
save the scaling information in the constructor and do the scaling
manually.

Hope this helps,

----Scott.
.



Relevant Pages

  • Re: A4 to Letter conversion
    ... works but I would like to scale the file properly. ... code snippet for scaling. ... know the dimensions of letter and you know the dimensions of ... Because this is anamorphic scaling, you will get differences in the ...
    (comp.lang.postscript)
  • Re: Linear scaling of sketches
    ... 3D Sketches are also needed! ... for the non-uniform scaling to occur! ... It is the sketches that are smart, i.e., they have dimensions ... sketcher that will scale an unconstrained sketch in both directions. ...
    (comp.cad.solidworks)
  • Re: engineering drawing question
    ... about drawings unable to be fabricated unless he went to get dimensions from ... lonely power-tripping clueless engineers, and tired of meeting time wasted ... Every drawing with its points dimensioned (as I had indicated ... relative to another by using the dimensions, such that you must scale it, ...
    (sci.engr.mech)
  • Re: 120dpi setting for windows and dynamic added controls
    ... The scaling example is fine. ... dependent on the Windows default font used for the UI, ... This method calculated the relative scale sizes from ... user controls would scale correctly ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: SketchUp7 users -"Dynamic" Kitchen Cabinet Face Frame components
    ... yet how to resize things to scale yet, but I watched a video on Fine Woodworking and it seemed easy enough by just selecting and moving part of the design. ... I haven't tried it yet, but on your base cabinet, which I grabbed, I attempted to select part of it but it didn't select as shown in the video... ... This worked pretty good, and I was impressed that after resizing the drawer I was working on, the dimensions I had made also changed to show the correct size. ... The scale tool I have all sorts of trouble with. ...
    (rec.woodworking)