Visual Studio Windows窗体控件在不同的计算机上重叠 [英] Visual Studio Windows Forms Controls are overlapping on different machines

查看:153
本文介绍了Visual Studio Windows窗体控件在不同的计算机上重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在64位Windows 7计算机上使用Microsoft Visual Studio 2010,该计算机具有1080p分辨率的屏幕监视器。我在MS VS 2010中设计了一个带有Designer的窗口。在那台机器上看起来很好。



现在我尝试在我的笔记本电脑上运行这个项目(也是MS VS 2010和Windows 7 64位),可能有不同的系统字体和不同的屏幕分辨率。



结果如下: http://puu.sh/1ZoRs [ ^ ] (不是说红色标签)



我在互联网上搜索了一个修复,但没有似乎也有帮助还尝试编辑一些属性并将代码中的字体更改为systemfonts。没有运气。



为什么会这样?有什么办法解决这个问题?为什么窗口/控件不会自动调整大小以适应所有内容?

I use Microsoft Visual Studio 2010 on a 64bits Windows 7 machine which has a screen monitor with 1080p resolution. I designed a window with the Designer in MS VS 2010. Looked good on that machine.

Now I try to run this project on my laptop (also MS VS 2010 and Windows 7 64bits), which has probably a different system font and a different screen resolution.

This is the result: http://puu.sh/1ZoRs[^] (not talking about the red lables)

I searched the internet for a fix, but nothing seems to help Also tried to edit some properties and changing the fonts to systemfonts in code. No luck.

Why does this happen? What''s the fix for this? Why doesn''t the window/controls resize automatically to fit everything?

推荐答案

如果正确设计UI布局,您将永远不会有不同屏幕的条件。这里的主要是避免任何绝对定位和尺寸。基本上,一切都应该停靠。请查看我过去的答案:

屏幕分辨率更改时,Zom Out出现故障 [ ^ ],

a基本代码示例:如何停靠按钮,以便它可以用表格调整 [ ^ ]。



-SA
You will never have this condition om different screens if you design the UI layout properly. Main thing here is to avoid any absolute positioning and sizing. Everything should be docked, basically. Please see my past answers:
Zom Out malfunctions when Screen resolution changes[^],
a rudimentary code sample here: how to dock button so that it can adjust with the form[^].

—SA


Windows窗体控件执行自动调整大小,这就是问题所在。你看到一切都变大了吗?这是因为屏幕不同......

他们自动调整以适应他们的内容 - 所以如果桌面上的字体在lappie上显示更大,那么在你的表单中分配给它的空间也是如此增加。不同的PC'可以有不同的默认字体大小...

你要求的是控件的大小保持不变,字体调整以适应控件 - 这不是不是在WinForms中发生,而是在WPF中发生,因此一种解决方案就是重写它。 (令人讨厌!)



更简单的解决方案可能是:在设计器中突出显示标签,然后按工具栏上的发送回按钮。
Windows forms controls do autosize, that''s the problem. You see how everything is bigger? It''s because teh screens are different...
They autosize to fit their content - so if a font on your desktop shows larger on the lappie, the the space allocated to it in your form also increases. And different PC''s can have different default font sizes...
What you are asking for is that the size of the controls stay the same, and the font adjusts to fit the controls - which doesn''t happen in WinForms, but does in WPF, so one solution is to re-write in that. (Nasty!)

A simpler solution might be: highlight your labels in the designer, and press the "send to back" button on the toolbar.


这篇关于Visual Studio Windows窗体控件在不同的计算机上重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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