WPF &分辨率无关 [英] WPF & resolution independent

查看:34
本文介绍了WPF &分辨率无关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我将所有内容都放在 viewbox 容器中,那么我的 wpf 应用程序将与分辨率无关,或者我需要做任何其他事情.请帮助概念.

if i put everything in viewbox container then my wpf apps will be resolution independent or do i need to do anything else. please help with concept.

推荐答案

根据可用屏幕或中等尺寸缩放​​元素
如果您希望始终填充屏幕或输出设备的某个空间,而不受指标影响,则使用视图框是一个不错的选择.如果你有一个大显示器,你会有一个大元素,如果你有一张小纸,你会有一个小打印出来的相同元素.
使用 Stretch 属性image 你只有图片才有类似的可能性.

Scale elements accordingly to the available screen or medium size
If your desire is, to allways fill some room of the screen or output device, independently of the metrics, using the viewbox is a good choice. If you have a big monitor, you will have a big element, if you have a small paper, you will have a small print out of the same element.
With the Stretch-property of an image you have a similar possibility only for pictures.

使每个设备上的元素大小相同
WPF 被设计为独立于分辨率".这种分辨率独立的目标是,如果您将一个元素设计为 15 英寸,那么它将在这 15 英寸的每个输出介质上,与您的输出设备的分辨率无关.尺寸的计算和规范在设备独立像素"(DIP) 您可以将其转换为厘米或英寸,而无需对输出设备分辨率有具体了解.

Make elements on every device equaly sized
WPF is designed "resolution independent". The goal of this resolution indepency is, that if you design an element to be 15 inches, then it will be on every output medium this 15 inches, independently of the resolution of your output device. Calculaction and specification of dimensions is done in "device independent pixels" (DIP) which you can convert to centimeters or inches without having specific knowledge about the output devices resolution.

96DIP == 1inch == 2.54cm;
1 英寸 == 96DPI;
1 厘米 == 37.8DIP;

96DIP == 1inch == 2.54cm;
1 inch == 96DPI;
1 cm == 37.8DIP;

如果要使用此分辨率独立性,您可以为元素设置固定值(以 DIP 为单位).在大型显示器上,您的元素可能只使用一小部分(例如 15 英寸),而在小型显示器上,它会填满整个屏幕(也是 15 英寸).

If want to use this resolution indepency, you can set fixed values (in DIPs) to your elements. On a large monitor then your element then maybe only uses a small part (e.G. 15inches), and on a small monitor it fills the whole screen (also 15inches).

这篇关于WPF &分辨率无关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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