如何强制应用程序忽略Windows缩放? [英] How can I force an application to ignore windows zoom?

查看:701
本文介绍了如何强制应用程序忽略Windows缩放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况:



我开发了一个使用winForms完成的应用程序,原生尺寸针对1920x1080进行了优化(因为它是标准配置)。

现在我有一台新的笔记本电脑,相同的分辨率和东西,但你必须设置缩放150%才能在该屏幕上看到任何东西(哑联想笔记本电脑:P)。



我从没想过缩放问题,但是现在,正如你所料,所有的视图和屏幕都有点不合适并且显示得非常难看。有趣的是,有些东西不会受到影响。有些东西会受到影响。



因此,作为快速修复,直到我能够将缩放设置正确,有没有办法强制原生比例而不是一个+窗口缩放?



提前致谢。



我尝试过:



在视图构造函数中将autoscalemode设置为none,但它似乎取代了ui并且它离开了它的中心位置。此外,它开始缩放,然后忽略缩放并取代自身。

The situation:

I developed an application that is done with winForms, the native sizes are optimized for 1920x1080 (since it's standard here).
Now i got a new laptop, same resolution and stuff but you have to set the zoom 150% to be able to see anything on that screen (dumb lenovo laptops :P).

I never thought about the zoom problem but now, as you could expect all views and screens are kinda off and display quite ugly. Fun fact, some stuff is not affected some stuff is affected.

So therefore as a quick fix until i am able to set the scaling correct, is there a way to force the native scale instead of the one + windows zoom?

Thanks in advance.

What I have tried:

Setting autoscalemode to none in the view constructor but it seems to displace the ui and it leaves its center position. Also it starts scaled and then ignores the scale and displaces itself.

推荐答案

基本上,GDI +管理需要如何渲染界面的所有内容,包括文本,图形和其他东西,这是由GDI +和像素大小管理的,旧笔记本电脑和较新笔记本电脑上字体的大小因像素密度不同而不同。问题:所有申请是否都经过相同的程序? (它们都没有对齐吗?)窗口大小不同,许多其他东西也是如此,为了使应用程序的UI适合每个屏幕,有一个团队设计应用程序如何响应不同的屏幕尺寸和像素密度。



由于问题在于带有更多像素的屏幕,它也发生在我身上,我做的是,我将缩放级别保持在同一水平( 100%)因为这是要生成的最佳图形质量。当然文字很小,图形较小,但那是2K图形的东西。 :-)我在这里建议的是,



1.为用户提供一个功能,他们可以在100%到150%之间轻松切换。

2.测量像素密度和屏幕分辨率,并重新调整应用程序的控件。对任何独立开发者来说,这都是艰巨的任务。

3. 接受决议。我们已经习惯了旧的图形和它们的像素密度,新的图形有点奇怪。我碰巧和我的LG G3打架,因为我之前的是三星Galaxy Grand Neo。



不要与之抗争,很快就会获得4K,你会做300%的变焦吗?当然不是。不是每个人都同意我们的意见,即将字体显示为最大尺寸。



以下链接将帮助您解决这个问题,

如何从C#winform应用程序中检索屏幕分辨率? - 堆栈溢出 [ ^ ]

DPI和设备无关的像素(Windows) [ ^ ]

实现高DPI桌面生活方式可能会让人痛苦--Scott Hanselman [ ^ ]
Basically, GDI+ manages everything that requires how the interface is rendered including the text, graphics and other stuff, this is managed by GDI+ and the pixel size, and the size of your font on the older laptop and the newer one are different because of different pixel density. Question: Are all the applications going through the same procedure? (Are they all not aligned?) The Window sizes are different and so are many other things and to keep the application's UI a fit for every screen, there is a team that designs how the application responds to different screen sizes, and pixel densities.

Since the problem is with the "screen with more pixels", it happened with me too, what I did was, I kept the zoom level to the same level (100%) as that is the best quality of graphics to be generated. Of course the text is small, graphics are smaller, but that is the thing of 2K graphics. :-) What I might suggest here is,

1. Provide a feature to the users where they can easily switch between 100% to 150% zoom.
2. Measure the pixel density and the screen resolution, and realign your application's controls. That is going to be tough task for any indie developer.
3. Embrace the resolution. We are used to with the old graphics and their pixel densities, the newer ones are a bit odd. I happened to fight with my LG G3 because my previous one was Samsung Galaxy Grand Neo.

Don't fight with it, soon you will get 4K, you would be doing a 300% zoom? Of course not. Not everyone shares our opinion of showing fonts to their largest possible size.

Following links will help you out in this,
How to retrieve the Screen Resolution from a C# winform app? - Stack Overflow[^]
DPI and Device-Independent Pixels (Windows)[^]
Living a High-DPI desktop lifestyle can be painful - Scott Hanselman[^]


这篇关于如何强制应用程序忽略Windows缩放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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