[Mono-bugs] [Bug 353827] New: Old style AutoScale is used when it shouldn't be
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Tue Jan 15 03:01:40 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=353827
Summary: Old style AutoScale is used when it shouldn't be
Product: Mono: Class Libraries
Version: 1.2.6
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Windows.Forms
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: jdpurcell2 at yahoo.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
All the applications I made in Visual Studio 2005 look fine in MS.NET but in
Mono the forms are being scaled even though AutoScaleMode is None. After many
hours of experimenting, I've discovered that this is because the older scaling
method (AutoScale) was enabled on the forms. AutoScale wasn't explicitly set,
but its default value is true. This is the same as in MS.NET, however, MS.NET
does 2 things to prevent the old style scaling from being used:
1) Upon explicitly setting AutoScaleMode, AutoScale is automatically set to
false. This behavior is documented in MSDN on the AutoScaleMode enumeration
page.
2) Even if AutoScale is left true, MS.NET effectively disables old style
scaling unless AutoScaleBaseSize is explicitly set. It does this by
automatically updating AutoScaleBaseSize whenever the form's font is changed,
based on that font (i.e. Form.GetAutoScaleSize for that font, and rounding from
SizeF to Size (not .ToSize which truncates)). I'm not sure if this is
documented.
A testcase is attached which shows AutoScale's value before and after
AutoScaleMode has been set, and shows how changing the form's font affects
AutoScaleBaseSize before and after AutoScaleBaseSize has been explicitly set.
Compile with:
gmcs -r:System.Drawing -r:System.Windows.Forms MyForm.cs
Output on MS.NET:
Default AutoScale: True
After setting AutoScaleMode: False
Initial AutoScaleBaseSize: 5x13
Font=10pt, Font AutoScaleSize=6x16, AutoScaleBaseSize=6x16
Font=12pt, Font AutoScaleSize=8x19, AutoScaleBaseSize=8x19
AutoScaleBaseSize has been explicitly set.
Font=14pt, Font AutoScaleSize=9x22, AutoScaleBaseSize=5x13
Output on Mono 1.2.6:
Default AutoScale: True
After setting AutoScaleMode: True
Initial AutoScaleBaseSize: 5x13
Font=10pt, Font AutoScaleSize=6x16, AutoScaleBaseSize=5x13
Font=12pt, Font AutoScaleSize=8x19, AutoScaleBaseSize=5x13
AutoScaleBaseSize has been explicitly set.
Font=14pt, Font AutoScaleSize=9x22, AutoScaleBaseSize=5x13
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list