Re: Windows Forms: Control.Scale(SizeF) does not work?
- From: Scott Gifford <sgifford@xxxxxxxxxxxxxxxx>
- Date: Mon, 18 Aug 2008 10:25:31 -0400
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.
.
- Follow-Ups:
- Re: Windows Forms: Control.Scale(SizeF) does not work?
- From: WernerG
- Re: Windows Forms: Control.Scale(SizeF) does not work?
- References:
- Windows Forms: Control.Scale(SizeF) does not work?
- From: WernerG
- Re: Windows Forms: Control.Scale(SizeF) does not work?
- From: Christopher Fairbairn [MVP]
- Re: Windows Forms: Control.Scale(SizeF) does not work?
- From: WernerG
- Windows Forms: Control.Scale(SizeF) does not work?
- Prev by Date: Re: Best strategy to solve performance issues ??
- Next by Date: Re: Debug on CE6.0 problem
- Previous by thread: Re: Windows Forms: Control.Scale(SizeF) does not work?
- Next by thread: Re: Windows Forms: Control.Scale(SizeF) does not work?
- Index(es):
Relevant Pages
|