473,382 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Scaling problem - font size

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
Jul 21 '05 #1
9 2436
Hi MOJO,

Based on your discription, I'm still not quite sure about the problem.
Could you tell me which window's size changed to 501*351? The one with
AutoScale set to true or false?

If it is the true one, it's because the size of the window is actually
changing. I didn't reproduced it on my machine when I set AutoScale to
false.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #2
Hi Kevin,

I'm sorry for beeing unclear.

Here's my question again....

I have a desktop computer with "Large fonts" and a laptop with "Small
fonts".

If I create a new project on my desktop and set the form size to 600x400
then when I open the same form (in vs.net form designer) on my laptop, it's
501x351 regardless of AutoScale is set to true or false.

In my search for a solution, I've stumbled over, that it must have somethig
to do with the AutoScaleBaseSize. I just can't figure out what to do.

I want to be able to open the form on my desktop and my laptop and keep the
size to 600x400, regardless of font sizes.

Hope you understand. :o)

Thanks!!!!

M O J O
"Kevin Yu [MSFT]" <v-****@online.microsoft.com> skrev i en meddelelse
news:GY**************@cpmsftngxa10.phx.gbl...
Hi MOJO,

Based on your discription, I'm still not quite sure about the problem.
Could you tell me which window's size changed to 501*351? The one with
AutoScale set to true or false?

If it is the true one, it's because the size of the window is actually
changing. I didn't reproduced it on my machine when I set AutoScale to
false.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #3
MOJO,

There may be a difference in the borders arround your forms. Try out
the following code to see if this helps you with your problem.

private void Form1_Load(object sender, System.EventArgs e)
{
Width = 640 - (Width - ClientSize.Width);
Height = 400 - (Height - ClientSize.Height);
}

"M O J O" <mojo@_no_spam_delete_this_newwebsolutions.dk> wrote in message news:<uf**************@TK2MSFTNGP09.phx.gbl>...
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

Jul 21 '05 #4
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

Jul 21 '05 #5
Hi MOJO,

I agree with John, that we should also set AutoScaleBaseSize according to
the form font to resolve this issue. According to John's suggestion, we
have to add the following lines of code when form loads to make the form
fit.

SizeF sf = Form.GetAutoScaleSize (this.Font);
this.AutoScaleBaseSize = sf.ToSize ();
this.AutoScale = true;

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #6
Hi John,

Thank you for answering my post!!!!

Unfortunately I cannot see any difference in doing what you suggested.

Please se my answer to Kevin.

Thanks anyway!!!!!

M O J O

"JohnReb" <Jo*****@discussions.microsoft.com> skrev i en meddelelse
news:95**********************************@microsof t.com...
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

Jul 21 '05 #7
Hi Kevin,

I tried to upload a couple of gif files to show what I mean, but MS' server
rejected the attachments.....hmmm.

I do not understand, that when I tell the form it should be 600x400 why the
form size changes under different font sizes.

The code you and John showed me only affects runtime, but in designtime
things look wird when going from "large fonts" to "small fonts".

M O J O

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> skrev i en meddelelse
news:Mg**************@cpmsftngxa10.phx.gbl...
Hi MOJO,

I agree with John, that we should also set AutoScaleBaseSize according to
the form font to resolve this issue. According to John's suggestion, we
have to add the following lines of code when form loads to make the form
fit.

SizeF sf = Form.GetAutoScaleSize (this.Font);
this.AutoScaleBaseSize = sf.ToSize ();
this.AutoScale = true;

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #8
Hi MOJO,

When fonts changes, we need to write additional codes to make size change
in design time. However, I think these codes are not provided in current
controls. So when the fonts changed when design time, there is no changes
of the size accordingly.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #9
Thank you for your answer.

M O J O

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> skrev i en meddelelse
news:cS**************@cpmsftngxa10.phx.gbl...
Hi MOJO,

When fonts changes, we need to write additional codes to make size change
in design time. However, I think these codes are not provided in current
controls. So when the fonts changed when design time, there is no changes
of the size accordingly.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Michel Joly de Lotbiniere | last post by:
I hope this is the correct newsgroup for this subject. The other day I came across a site www.safesquid.com that specified font-family:Terminal font-size:9pt in the inline css for command-line...
4
by: Eric Eggermann | last post by:
Hello all, I'm building an app that lays out and prints flash cards. Now the card might be any size, but when the user is working on the card, I draw the preview isotropically, as large as...
0
by: LR | last post by:
I'm having problem scaling controls on the form. I have a form where I'm adding my user control at design time. If I run at 96 dpi it looks fine, all the controls inside my user control are sized...
7
by: jozsi | last post by:
hi i developed my application for window resolution 1280*1024 now i have a remote maschine using a window resolution of 1024*768 is there a easy way to scale alle the object in the form? ...
4
by: Bernie Yaeger | last post by:
I'd like to allow the user to zoom a window using a trackbar, say from 80% to 120% the size of the original window. I'm trying to do this with the following code, but it fails pretty miserably:...
9
by: M O J O | last post by:
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...
3
by: Joseph Gruber | last post by:
Hi all -- I have two questions. First, I'm adding a control to my form at runtime and the control/form seems to ignore the anchor property of the runtime control. Any idea how I can get a...
0
by: igalep132 | last post by:
Hey all, I was trying to resize control size to the form size. I'm changing my form size according to current Screen Size by using Screen.PrimaryScreen.WorkingArea; and then I'm making a...
2
by: sam | last post by:
can someone show how to change print font width & heigh scaling? I am writing a code for barcode printing on smaller label. I do not want change font size, because this may cause the bar code...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.