RE: Scaling problem - font size
From: JohnReb (JohnReb_at_discussions.microsoft.com)
Date: 09/03/04
- Next message: JohnReb: "C#.NET Comment Web Page on XP SP2"
- Previous message: mark: "Get machine OU"
- In reply to: M O J O: "Scaling problem - font size"
- Next in thread: M O J O: "Re: Scaling problem - font size"
- Reply: M O J O: "Re: Scaling problem - font size"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 3 Sep 2004 12:21:05 -0700
I have had this same problem, and have found that the following workaround is
reasonably successful:
In every constructor of every form, as the first statement after the call to
InitializeComponent () add:
SizeF sf = Form.GetAutoScaleSize (this.Font);
this.AutoScaleBaseSize = sf.ToSize ();
I created a class with a static method so I can make it in one line, since
it is used a lot:
this.AutoScaleBaseSize = autoScaleHelpClass.GetBaseSize (this.Font);
After adding this, my app works pretty well among large and small font
systems, at multiple resolutions. Not perfect, but pretty good.
Hope this helps.
John
"M O J O" wrote:
> Hi,
>
> I have my windows-display-font-size set to "Large fonts" and I've created a
> new project with two forms. Both of them are 600 width and 400 height. One
> have autoscale=true and the other is false. When I run the project, the two
> forms shows the same size.
>
> Now I open the project (in vs.net) on a computer with
> windows-display-font-size set to "Small fonts" and my project is screwed up.
> Now the width is 501 and the height is 351????????!!!!! When I run the
> project, the form with autoscale=true is smaller, which I can understand.
>
> My question is .... why isn't my form size 600x400 when I open it on a
> computer with "Small fonts"? ... and how can I make it the same size?
>
> Lets say two develloper worked on the same project. One use "Large fonts"
> and the other "Small fonts". How can I make vs.net show the forms at the
> same size on both devellopers vs.net??
>
> STRANGE! :o)
>
> Thanks in advance!
>
> M O J O
>
>
>
- Next message: JohnReb: "C#.NET Comment Web Page on XP SP2"
- Previous message: mark: "Get machine OU"
- In reply to: M O J O: "Scaling problem - font size"
- Next in thread: M O J O: "Re: Scaling problem - font size"
- Reply: M O J O: "Re: Scaling problem - font size"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|