没有ControlBox的Windows窗体中的AutoSize [英] AutoSize in Windows Forms without a ControlBox

查看:136
本文介绍了没有ControlBox的Windows窗体中的AutoSize的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于Windows 7中的文本和图标大小调整,我遇到了一个通用的Windows窗体应用程序和自动调整问题。以下是步骤:

I am having an issue a generic Windows Forms application and AutoSizing due to text and icon sizing in Windows 7.  Here are the steps:


  1. 在Visual Studio 2010中启动新的Windows窗体应用程序(我正在使用框架3.5)
  2. 将Form1的AutoSize属性设置为True
  3. 将Form1的ControlBox属性设置为False
  4. 将Form1的FormBorderStyle属性设置为FixedSingle
  5. 将工具箱中的按钮拖放到表单上,并将其放在Form1的最右下角
  6. 将Button1的Anchor属性设置为Bottom和Right
  7. 构建项目

现在运行项目的可执行文件会产生预期的结果。  它看起来与设计师完全一样。  大。  现在在Windows 7中,转到"控制面板"中的"显示",并将 外观更改为当前以外的其他内容。
  Mine设置为"Smaller - 100%(默认)",因此我将其更改为"Medium - 125%"。  点击"应用"按钮然后注销。  重新登录,您的图标和文字大小不同。  现在运行您编译的可执行文件。  按钮是
,不再在右下角。  如果重复上述过程,除了不将Form1的ControlBox属性设置为False,该按钮将处于"正确"状态。地点。  任何见解都会很棒。

Now running the executable of the project yields the results expected.  It looks exactly like the designer.  Great.  Now in Windows 7, goto to Display in the Control Panel and change the appearance to something other than current.  Mine was set on "Smaller - 100% (default)", so I changed it to "Medium - 125%".  Click "Apply" and then log off.  Log back on and your icons and text are a different size.  Now run the executable that you compiled.  The button is no longer in the bottom right hand corner.  If you repeat the above procedure except do not set the ControlBox property of Form1 to False, the button will be in the "correct" place.  Any insight would be great.

 

提前致谢,

 

推荐答案

只是一个猜测:

将Forms AutoScaleMode设置为与Font(eG Dpi)不同的东西。

set the Forms AutoScaleMode to something different than Font (e.G Dpi).


这篇关于没有ControlBox的Windows窗体中的AutoSize的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆