简体   繁体   English

Winforms应用程序控制在生产PC上更改大小

[英]Winforms app controls change size on production PC

I'm developing a small winforms app for internal use. 我正在开发内部使用的小型Winforms应用程序。 My dev pc runs Windows 7 however most of the other team members (ie the users of the app) are running Windows 8.1. 我的开发人员计算机运行Windows 7,但是其他大多数团队成员(即应用程序的用户)都运行Windows 8.1。 The winforms controls all render slightly differently in Windows 8.1 and this causes some problems such as buttons cutting off text due to size differences. 在Windows 8.1中,winforms控件的所有呈现方式略有不同,这会导致一些问题,例如由于大小差异而导致按钮将文本截断的问题。

Is there a way to see how the app will render in Windows 8.1 on my Windows 7 dev PC? 有没有办法查看该应用程序如何在Windows 7开发PC上的Windows 8.1中呈现? Note I'm talking about a regular winforms app, not a Metro style app. 注意我在说的是常规的winforms应用程序,而不是Metro风格的应用程序。

I'm developing in C# using Visual Studio Professional 2013 我正在使用Visual Studio Professional 2013在C#中进行开发


EDIT 编辑

Note that I have now also tried using https://github.com/viperneo/winforms-modernui and I get similar behaviour. 请注意,我现在也尝试使用https://github.com/viperneo/winforms-modernui,并且我得到了类似的行为。 I have a DateTimePicker next to a Button and I make their height's the same. 我在Button旁边有一个DateTimePicker ,并使它们的高度相同。 On my Windows 7 dev PC this looks correct. 在我的Windows 7开发PC上,这看起来是正确的。 However when I run it on a Windows 8 "production" PC the button height is now shorter than the DateTimePicker , things become misaligned in general and some controls even start to partially overlap. 但是,当我在Windows 8“生产” PC上运行它时,按钮的高度现在比DateTimePicker短,一般情况下,它们变得不对齐,并且某些控件甚至开始部分重叠。 The screen resolutions of the two PCs is the same 两台电脑的屏幕分辨率相同

Check to see what DPI setting that all/each of your users are using. 检查所有/每个用户使用的DPI设置。 Windows Forms will always render differently with each DPI scaling setting regardless if it is Windows 7 or Windows 8. Takes a fair bit of work in dev and testing with each major DPI increment but it can be done to get a decent look. 不管是Windows 7还是Windows 8,Windows窗体在每个DPI缩放设置中都将始终呈现不同的外观。在每个主要DPI增量上都需要进行大量的开发和测试工作,但是可以这样做以获得不错的外观。

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

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