I have an large application developed in .Net Compact Framework 1.0 that has been developed over the last 9 years with large amount of forms and custom controls. The application is designed for 240×320 screens. It scales good to a 480×640 screen when compiled with Compact .Net 1.0 and Visual Studio 2003.
I upgraded the application to .Net 2.0 using the default upgrade wizard of Visual Studio 2008. The application uses the full screen and all the controls are laid out as designed when using a device with resolution of 240×320. But the application uses only top left 25% of the screen when using a device with resolution of 480×640.
I tried using the code:
AutoScaleDimensions = new SizeF(96,96);
AutoScaleMode = AutoScaleMode.Dpi;
It works on the Form, but does not work on the dynamic controls (standard/custom) that are placed on the form.
Is there a way to force the application to use scaling similar to that done when complied using .Net 1.0, with out using the AutoScaleDimensions/AutoScaleMode properties.
Thanks.
I found a kind of solution to this problem.
I get the scale-factor similar to the procedure explained by simons19 and then when adding any dynamically created control to the form, I call the method control.Scale(scale-factor). This solved my problem. Scale method scales both Location and Size of the control so, I set both location property and size property of the dynamically created control before calling the scale property.
Example: