dotnetmonitor.com

 
Index
Previous
Next

 

AutoScale refers in general to recalculating sizes and positions for controls without reliance on an outer layout container or engine doing the calculation. This is done for environment changes like font, DPI etc.

 

For Everett the default code spit was :

 

this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

 

AutoScaleBase size attempts to store the size of the font rendered at the DPI of the machine. As is clearly apparent the Size type only stores integer values, from here the problem of conversion accuracy stems. After repeated changes, rounding errors can introduce noticable and at times, unacceptable loss of accuracy.

 

For Whidbey, the default code spit is now

 

this.AutoScaleDimensions = new System.Drawing.SizeF(6.0F, 13.0F);

 

We now store the dimensions of the font in a SizeF which leads to much greater accuracy. In addition we offer three AutoScaleModes.

 

Interestingly, both of these autoscale approaches coexist. The two members controlling these two systems are below

  • AutoScale bool that enables/disables the Everett auto scaling system.
  • AutoScaleMode enum including entry of None to map to AutoScale true. All other settings enable Whidbey auto scaling system.

 

 

AutoScaleMode

AutoScale

None

Font

DPI

True

Everett scaling

n/a

n/a

False

n/a

DEFAULT

Whidbey scaling enabled, font AND dpi changes are handled.

Whidbey scaling enabled, only dpi changes are handled

n/a means that that property combination is not achievable. Property sets on one side set the property on the other. For AutoScale set to False, AutoScaleMode will be set to Font

Terms
Docking Anchor Layout
What happens when I have Dock and Anchors that conflict?
Dock Scenarios
Padding Margin
You have a perf problem with Layout - how to diagnose?