开发者

How is Visual Studio 2008 Windows Forms Designer both QVGA and VGA Compatible?

In Visual Studio 2008 when working with a Smart Device project, if I use the Window Forms Designer to add controls to a form, then the controls will be displayed in the correct place when the program is actually running whether the device has a QVGA or VGA screen. However if I add controls to the form in my code manually without using the Designer, then I need have my code check at run time whether the device has a VGA screen or a QVGA screen. If it is a VGA screen I have to multiple the x, y, width, and height by 2 for each control added manually. Why 开发者_Python百科is that only necessary for controls added without using the designer?

I just added a comment below the first answer.


Controls that are added at design time are autoscaled when first drawn, due to these properties in the designer.cs:

this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;

When you dynamically add controls at runtime you'll need to perform your own scaling. Its not ideal, but its just the way it works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜