The Lanham Factor
The (ir)rational thoughts of a (not-so)mad man

WinForms AutoScaleMode - Your One-Way Ticket to Pain & Suffering

Thursday, February 15, 2007 2:21 PM

In the ongoing saga of "I can't believe it's not GDI" (aka - Trying to get GDI+ to play nicely with refreshing user controls and picture boxes images as drawing surfaces)...

The AutoScaleMode property applies to WinForms controls and forms (which are controls) and allows the widgets on the control to scale based on changes in other settings such as Font and Screen Resolution.  This makes sense in that if you have poorly sighted users, for example, you don't want to manually control resizing of every child control ad nauseum.  It also makes sense that the default setting for this property is "Font".  Most users, regardless of resolution, depend on font sizes to improve readability.

Interestingly enough, it also seems that ALL controls are affected by the scaling...even controls that do are not displaying fonts (such as picture box controls.  Most of me says "this makes sense" but a small part of me says it doesn't...just a small part.

d n i w e R...about 8 weeks...the client asked for a run-time font setting of Tahoma 30.  The designer, of course, assumes a default setting like Times 12 or some such.  This was causing serious trouble when moving from the designer to the run-time.  To help alleviate the challenges, I decided to set the font on all forms to Tahoma 30 at design time.

Fast-Forward to this week.  As you know we have been having all sorts of trouble with GDI+, etc. etc.  The client writes a user control that handles the drawing and such and it works beautifully...in the sandbox.  Plug it into the production application and the images simply do NOT layout correctly.  (at this point you can see where this is going)

Bottom Line: AutoScaleMode makes me sad.




Feedback

No comments posted yet.


Post a comment