I have just been playing with AutoScale and I am unhappy with the way it
appears to work.

I have a form created on a desktop m/c where the screen font is Normal (96
dpi). The form looks fine at design time and runtime. I run the application
on my laptop, where the screen font is set to 120 dpi (125%), and the form
does not look fine. The line height of a listbox on the form is too small,
labels are truncated, and things generally look cramped. AutoScale is set to
True.

I notice that when I open the designer on the desktop, the AutoScaleBaseSize
is (5, 13). When I open the designer on the laptop it is also (5,13). If I
then change the AutoScale property in the properties window and look again
at AutoScaleBaseSize, it has changed to (6,15). Now when I run the
application on the laptop all is well. Well, almost. I should point out that
user controls on the form still do not scale correctly, and since they do
not have an AutoScale property, all I can think of doing is calling the
Scale() method with a parameter of 1.25. The problem with this approach is
that I would have to do this for every user control, and there are a lot of
them. It doesn't seem right that I have to add special code to all my user
controls to get them to scale properly. Furthermore, I haven't discovered
(yet) how to determine the correct scale factor at runtime.

I thought that the point of the AutoScale property was that a form would
display correctly on m/cs with different display settings, without having to
rebuild on that m/c. It doesn't look like that is what really happens.

Have I missed out a step here? Does anyone know the correct procedure for
making this work?

TIA

Charles

Re: AutoScale Doesn't Behave How I Expect/Hope by Francisco

Francisco
Sat May 21 19:17:25 CDT 2005

I don't know whether this is a bug or the intended behavior but I had the
same problem you are having. The way I solved it was by setting my autoscale
property in code and not at design time:

AutoScaleDimensions = new System.Drawing.SizeF(96F,96F);

AutoScaleMode = AutoScaleMode.Dpi;



Doing this, my forms resize correctly when I run my app in a machine with
different DPI.

Now this assumes the forms were designed using 96 dpi. This approach would
not work if you need to design forms at different DPI's.


--
Francisco Padron
www.chartfx.com



"Charles Law" <blank@nowhere.com> wrote in message
news:e1ig3ysWFHA.3176@TK2MSFTNGP12.phx.gbl...
>I have just been playing with AutoScale and I am unhappy with the way it
> appears to work.
>
> I have a form created on a desktop m/c where the screen font is Normal (96
> dpi). The form looks fine at design time and runtime. I run the
> application
> on my laptop, where the screen font is set to 120 dpi (125%), and the form
> does not look fine. The line height of a listbox on the form is too small,
> labels are truncated, and things generally look cramped. AutoScale is set
> to
> True.
>
> I notice that when I open the designer on the desktop, the
> AutoScaleBaseSize
> is (5, 13). When I open the designer on the laptop it is also (5,13). If I
> then change the AutoScale property in the properties window and look again
> at AutoScaleBaseSize, it has changed to (6,15). Now when I run the
> application on the laptop all is well. Well, almost. I should point out
> that
> user controls on the form still do not scale correctly, and since they do
> not have an AutoScale property, all I can think of doing is calling the
> Scale() method with a parameter of 1.25. The problem with this approach is
> that I would have to do this for every user control, and there are a lot
> of
> them. It doesn't seem right that I have to add special code to all my user
> controls to get them to scale properly. Furthermore, I haven't discovered
> (yet) how to determine the correct scale factor at runtime.
>
> I thought that the point of the AutoScale property was that a form would
> display correctly on m/cs with different display settings, without having
> to
> rebuild on that m/c. It doesn't look like that is what really happens.
>
> Have I missed out a step here? Does anyone know the correct procedure for
> making this work?
>
> TIA
>
> Charles
>
>



Re: AutoScale Doesn't Behave How I Expect/Hope by Charles

Charles
Sun May 22 06:20:05 CDT 2005

Hi Francisco

Thanks for the reply. It looks like I may have to do this, but it will mean
a lot of additional code as there are many forms. I will also have to
remember to add it to any new forms.

Do you know how this could be used for user control, as they do not appear
to have an AutoScale property?

Charles


"Francisco Padron" <noreply@softwarefx.com> wrote in message
news:uoffTOmXFHA.616@TK2MSFTNGP12.phx.gbl...
>I don't know whether this is a bug or the intended behavior but I had the
>same problem you are having. The way I solved it was by setting my
>autoscale property in code and not at design time:
>
> AutoScaleDimensions = new System.Drawing.SizeF(96F,96F);
>
> AutoScaleMode = AutoScaleMode.Dpi;
>
>
>
> Doing this, my forms resize correctly when I run my app in a machine with
> different DPI.
>
> Now this assumes the forms were designed using 96 dpi. This approach would
> not work if you need to design forms at different DPI's.
>
>
> --
> Francisco Padron
> www.chartfx.com
>
>
>
> "Charles Law" <blank@nowhere.com> wrote in message
> news:e1ig3ysWFHA.3176@TK2MSFTNGP12.phx.gbl...
>>I have just been playing with AutoScale and I am unhappy with the way it
>> appears to work.
>>
>> I have a form created on a desktop m/c where the screen font is Normal
>> (96
>> dpi). The form looks fine at design time and runtime. I run the
>> application
>> on my laptop, where the screen font is set to 120 dpi (125%), and the
>> form
>> does not look fine. The line height of a listbox on the form is too
>> small,
>> labels are truncated, and things generally look cramped. AutoScale is set
>> to
>> True.
>>
>> I notice that when I open the designer on the desktop, the
>> AutoScaleBaseSize
>> is (5, 13). When I open the designer on the laptop it is also (5,13). If
>> I
>> then change the AutoScale property in the properties window and look
>> again
>> at AutoScaleBaseSize, it has changed to (6,15). Now when I run the
>> application on the laptop all is well. Well, almost. I should point out
>> that
>> user controls on the form still do not scale correctly, and since they do
>> not have an AutoScale property, all I can think of doing is calling the
>> Scale() method with a parameter of 1.25. The problem with this approach
>> is
>> that I would have to do this for every user control, and there are a lot
>> of
>> them. It doesn't seem right that I have to add special code to all my
>> user
>> controls to get them to scale properly. Furthermore, I haven't discovered
>> (yet) how to determine the correct scale factor at runtime.
>>
>> I thought that the point of the AutoScale property was that a form would
>> display correctly on m/cs with different display settings, without having
>> to
>> rebuild on that m/c. It doesn't look like that is what really happens.
>>
>> Have I missed out a step here? Does anyone know the correct procedure for
>> making this work?
>>
>> TIA
>>
>> Charles
>>
>>
>
>



Re: AutoScale Doesn't Behave How I Expect/Hope by Francisco

Francisco
Sun May 22 10:47:44 CDT 2005

Sorry, my mistake, AutoScaleDimensions and AutoScaleMode seem to be new in
Whidbey which is where I'm using them.

The belong to ContainerControl from which both UserControl and Form derive,
as for adding the code to all forms yes it is a little bit of a pain,
however I do it by calling a utility function whenever I create a new form.

I do not know whether there is a solution that will work in .NET 1.x.

--
Francisco Padron
www.chartfx.com


"Charles Law" <blank@nowhere.com> wrote in message
news:ecDHvAsXFHA.3864@TK2MSFTNGP10.phx.gbl...
> Hi Francisco
>
> Thanks for the reply. It looks like I may have to do this, but it will
> mean a lot of additional code as there are many forms. I will also have to
> remember to add it to any new forms.
>
> Do you know how this could be used for user control, as they do not appear
> to have an AutoScale property?
>
> Charles
>
>
> "Francisco Padron" <noreply@softwarefx.com> wrote in message
> news:uoffTOmXFHA.616@TK2MSFTNGP12.phx.gbl...
>>I don't know whether this is a bug or the intended behavior but I had the
>>same problem you are having. The way I solved it was by setting my
>>autoscale property in code and not at design time:
>>
>> AutoScaleDimensions = new System.Drawing.SizeF(96F,96F);
>>
>> AutoScaleMode = AutoScaleMode.Dpi;
>>
>>
>>
>> Doing this, my forms resize correctly when I run my app in a machine with
>> different DPI.
>>
>> Now this assumes the forms were designed using 96 dpi. This approach
>> would not work if you need to design forms at different DPI's.
>>
>>
>> --
>> Francisco Padron
>> www.chartfx.com
>>
>>
>>
>> "Charles Law" <blank@nowhere.com> wrote in message
>> news:e1ig3ysWFHA.3176@TK2MSFTNGP12.phx.gbl...
>>>I have just been playing with AutoScale and I am unhappy with the way it
>>> appears to work.
>>>
>>> I have a form created on a desktop m/c where the screen font is Normal
>>> (96
>>> dpi). The form looks fine at design time and runtime. I run the
>>> application
>>> on my laptop, where the screen font is set to 120 dpi (125%), and the
>>> form
>>> does not look fine. The line height of a listbox on the form is too
>>> small,
>>> labels are truncated, and things generally look cramped. AutoScale is
>>> set to
>>> True.
>>>
>>> I notice that when I open the designer on the desktop, the
>>> AutoScaleBaseSize
>>> is (5, 13). When I open the designer on the laptop it is also (5,13). If
>>> I
>>> then change the AutoScale property in the properties window and look
>>> again
>>> at AutoScaleBaseSize, it has changed to (6,15). Now when I run the
>>> application on the laptop all is well. Well, almost. I should point out
>>> that
>>> user controls on the form still do not scale correctly, and since they
>>> do
>>> not have an AutoScale property, all I can think of doing is calling the
>>> Scale() method with a parameter of 1.25. The problem with this approach
>>> is
>>> that I would have to do this for every user control, and there are a lot
>>> of
>>> them. It doesn't seem right that I have to add special code to all my
>>> user
>>> controls to get them to scale properly. Furthermore, I haven't
>>> discovered
>>> (yet) how to determine the correct scale factor at runtime.
>>>
>>> I thought that the point of the AutoScale property was that a form would
>>> display correctly on m/cs with different display settings, without
>>> having to
>>> rebuild on that m/c. It doesn't look like that is what really happens.
>>>
>>> Have I missed out a step here? Does anyone know the correct procedure
>>> for
>>> making this work?
>>>
>>> TIA
>>>
>>> Charles
>>>
>>>
>>
>>
>
>



Re: AutoScale Doesn't Behave How I Expect/Hope by Phil

Phil
Sat Jun 04 15:11:20 CDT 2005

I have never been able to get the AutoScale to work correctly. Another issue
is if you have a control is has a docking value of Fill then you would
expect its size to ignore any scaling because it needs to fill the spare
area in the parent container. But no, when the control is first created it
makes itself bigger! than the fill area until it is resized. In short I
would avoid its use. I notice that VS.NET 2005 Beta 2 does away with using
AutoScale.

Phil Wright
Follow the microISV story at...
http://componentfactory.blogspot.com

"Charles Law" <blank@nowhere.com> wrote in message
news:e1ig3ysWFHA.3176@TK2MSFTNGP12.phx.gbl...
>I have just been playing with AutoScale and I am unhappy with the way it
> appears to work.
>
> I have a form created on a desktop m/c where the screen font is Normal (96
> dpi). The form looks fine at design time and runtime. I run the
> application
> on my laptop, where the screen font is set to 120 dpi (125%), and the form
> does not look fine. The line height of a listbox on the form is too small,
> labels are truncated, and things generally look cramped. AutoScale is set
> to
> True.
>
> I notice that when I open the designer on the desktop, the
> AutoScaleBaseSize
> is (5, 13). When I open the designer on the laptop it is also (5,13). If I
> then change the AutoScale property in the properties window and look again
> at AutoScaleBaseSize, it has changed to (6,15). Now when I run the
> application on the laptop all is well. Well, almost. I should point out
> that
> user controls on the form still do not scale correctly, and since they do
> not have an AutoScale property, all I can think of doing is calling the
> Scale() method with a parameter of 1.25. The problem with this approach is
> that I would have to do this for every user control, and there are a lot
> of
> them. It doesn't seem right that I have to add special code to all my user
> controls to get them to scale properly. Furthermore, I haven't discovered
> (yet) how to determine the correct scale factor at runtime.
>
> I thought that the point of the AutoScale property was that a form would
> display correctly on m/cs with different display settings, without having
> to
> rebuild on that m/c. It doesn't look like that is what really happens.
>
> Have I missed out a step here? Does anyone know the correct procedure for
> making this work?
>
> TIA
>
> Charles
>
>