简体   繁体   English

Windows Forms .NET Framework中的位移控件

[英]Displaced controls in windows forms .net framework

I have a strange problem. 我有一个奇怪的问题。 I have designed a windows form application in c# and .net framework 3.5. 我在c#和.net framework 3.5中设计了一个Windows窗体应用程序。 In the runtime, the form and its controls are fine in all the computers except my laptop, where the controls are not in the correct positions. 在运行时,表单及其控件在除笔记本电脑之外的所有计算机中都很好,控制器位置不正确。

If I design the form from scratch on my laptop with correct positioning it will result in an invalid shape for other computers. 如果我在笔记本电脑上从头开始设计表格并且位置正确,则会导致其他计算机的形状无效。

My efforts: 我的努力:

  • If I run the windows in Safe Mode the form size and control positions are correct. 如果我在安全模式下运行Windows,则窗体大小和控件位置都是正确的。
  • I have uninstalled the Video Driver and used default windows version but the problem still persists. 我已经卸载了视频驱动程序并使用了默认的Windows版本,但问题仍然存在。
  • I used different frameworks like 2.0 and 4.0, and different Visual Studios versions and they all have the same problems. 我使用了不同的框架,如2.0和4.0,以及不同的Visual Studios版本,它们都有相同的问题。
  • Actually all the .net framework product from all the companies indicate the same issue. 实际上,所有公司的所有.net框架产品都表示相同的问题。

My computer Settings: Laptop 1557 Studio DELL Graphic ATI Radeon HD 4500 我的电脑设置:笔记本电脑1557 Studio DELL图形ATI Radeon HD 4500

I assume it is due to a screen resolution differences. 我认为这是由于屏幕分辨率的差异。 I believe that the actual location of the controls is identical in both cases, in one the screen is "larger" and therefor your controls appear in a different position on the screen. 我相信控件的实际位置在两种情况下都是相同的,在一种情况下,屏幕“较大”,因此控件在屏幕上的位置不同。

try Designing forms to work on different resolutions and aspect ratios on Windows CE 尝试设计表单以在Windows CE上以不同的分辨率和宽高比工作

Another thing you can (and should) do is work with WPF, which is the new way to build user interfaces for windows. 您可以(而且应该)做的另一件事是使用WPF,这是为Windows构建用户界面的新方法。

I've found a workaround just now. 我刚刚找到了解决方法。 In the display settings of Windows 7 I have changed the Text size from 125% to 100%. 在Windows 7的显示设置中,我已将文本大小从125%更改为100%。 Everything is smaller but in accurate positions and sizes. 一切都变小了,但位置和大小都准确。 Still wondering how it works!! 仍然想知道它是如何工作的!

When the text size is artificially increased to 125% text and controls that are rather closely placed will wrap around the form and push everything down/over. 当文本大小被人为地增加到125%时,文本和相当紧密放置的控件将环绕表单并向下推/向下推动所有内容。 If this is something you intend to support, you'll simply have to redesign your form to handle the different enlargement levels you care to support and test those enlarged text modes in your app until you're satisfied with their appearance. 如果这是您打算支持的内容,您只需重新设计表单即可处理您需要支持的不同放大级别,并在应用中测试这些放大的文本模式,直到您对其外观满意为止。 It's not something you can strictly control, since increased text size is an accessibility feature. 这不是你可以严格控制的东西,因为增加的文本大小是一个可访问性功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM