分辨率 免费申请

发布于 2024-08-30 07:54:01 字数 104 浏览 6 评论 0原文

无分辨率应用程序是什么意思,正如我与许多朋友讨论过的那样,他们说无分辨率意味着用户希望看到的应用程序的分辨率是什么,它应该调整其位置,分辨率是显示器分辨率或任何说 100 100 什么是分辨率?

What is meant by the Resolution free application, As I have discussed it with many of my friend and they says that resolution free mean what ever resolution user want to see an application it should adjust it position, the resolultion is monitor resolution or any say 100 by 100 what is resolution?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

ま昔日黯然 2024-09-06 07:54:01

理想情况下,应用程序将使用更高的像素密度来显示更多细节。例如,高分辨率显示器可以显示类似大小的工具栏图标,但使用额外的像素来呈现更清晰的图形。这样您就可以保持相同的基本布局,但提供更高的清晰度和细节。由于多种原因,这种解决方案在过去是不可能的。尽管您可以调整使用 GDI/GDI+ 绘制的图形内容的大小,但 User32(为常见控件生成视觉效果)不支持真正的缩放。

WPF 不会遇到此问题,因为它本身会呈现所有用户界面元素,从简单的形状到按钮等常见控件。因此,如果您在计算机显示器上创建一个 1 英寸宽的按钮,它可以在高分辨率显示器上保持 1 英寸宽 — WPF 将简单地以更多细节和更多像素渲染它。

WPF 的缩放基于系统 DPI 设置,而不是物理显示设备的 DPI。它在计算大小时使用系统 DPI 设置。

WPF 单位

WPF 窗口及其内部的所有元素均使用与设备无关的单位进行测量。与设备无关的单位定义为 1/96 英寸。要理解这在实践中意味着什么,您需要考虑一个示例。

想象一下,您在 WPF 中创建一个大小为 96 x 96 单位的小按钮。如果您使用标准 Windows DPI 设置 (96 dpi),则每个与设备无关的单位对应于一个真实的物理像素。这是因为 WPF 使用此计算:

[Physical Unit Size] = [Device-Independent Unit Size] × [System DPI]

                 = 1/96 inch × 96 dpi

                 = 1 pixel

本质上,WPF 假设一英寸需要 96 个像素,因为 Windows 通过系统 DPI 设置告诉它这一点。然而,实际情况取决于您的显示设备。

例如,考虑最大分辨率为 1600 x 1200 像素的 20 英寸 LCD 显示器。使用毕达哥拉斯破折号,您可以计算出该显示器的像素密度,如下所示:

[Screen DPI] = ((Sqroot of)(1600*1600)+(1200*1200))pixels/19 inches = 100dpi

在本例中,像素密度计算为 100 dpi,略高于 Windows 假设的值。因此,在此显示器上,96 x 96 像素的按钮将略小于 1 英寸。

另一方面,考虑分辨率为 1024 x 768 的 15 英寸 LCD 显示器。此处,像素密度降至约 85 dpi,因此 96 x 96 像素按钮看起来略大于 1 英寸。

在这两种情况下,如果减小屏幕尺寸(例如,切换到 800 x 600 分辨率),按钮(以及所有其他屏幕元素)将按比例显示更大。这是因为系统 DPI 设置保持在 96 dpi。换句话说,Windows 继续假设一英寸需要 96 个像素,即使在较低的分辨率下,它需要的像素要少得多。

参考:
C# 2008 中的 Pro WPF:带有 .NET 3.5 的 Windows Presentation Foundation,第二版

Ideally, applications would use higher pixel densities to show more detail. For example, a high-resolution monitor could display similarly sized toolbar icons but use the extra pixels to render sharper graphics. That way you could keep the same basic layout but offer increased clarity and detail. For a variety of reasons, this solution hasn’t been possible in the past. Although you can resize graphical content that’s drawn with GDI/GDI+, User32 (which generates the visuals for common controls) doesn’t support true scaling.

WPF doesn’t suffer from this problem because it renders all user interface elements itself, from simple shapes to common controls such as buttons. As a result, if you create a button that’s 1 inch wide on your computer monitor, it can remain 1 inch wide on a high-resolution monitor—WPF will simply render it in greater detail and with more pixels.

WPF bases its scaling on the system DPI setting, not the DPI of your physical display device. It uses the system DPI setting when it calculates sizes.

WPF Units

A WPF window and all the elements inside it are measured using device-independent units. A single device-independent unit is defined as 1/96 of an inch. To understand what this means in practice, you’ll need to consider an example.

Imagine that you create a small button in WPF that’s 96 by 96 units in size. If you’re using the standard Windows DPI setting (96 dpi), each device-independent unit corresponds to one real, physical pixel. That’s because WPF uses this calculation:

[Physical Unit Size] = [Device-Independent Unit Size] × [System DPI]

                 = 1/96 inch × 96 dpi

                 = 1 pixel

Essentially, WPF assumes it takes 96 pixels to make an inch because Windows tells it that through the system DPI setting. However, the reality depends on your display device.

For example, consider a 20-inch LCD monitor with a maximum resolution of 1600 by 1200 pixels. Using a dash of Pythagoras, you can calculate the pixel density for this monitor, as shown here:

[Screen DPI] = ((Sqroot of)(1600*1600)+(1200*1200))pixels/19 inches = 100dpi

In this case, the pixel density works out to 100 dpi, which is slightly higher than what Windows assumes. As a result, on this monitor a 96-by-96-pixel button will be slightly smaller than 1 inch.

On the other hand, consider a 15-inch LCD monitor with a resolution of 1024 by 768. Here, the pixel density drops to about 85 dpi, so the 96-by-96 pixel button appears slightly larger than 1 inch.

In both these cases, if you reduce the screen size (say, by switching to 800 by 600 resolution), the button (and every other screen element) will appear proportionately larger. That’s because the system DPI setting remains at 96 dpi. In other words, Windows continues to assume it takes 96 pixels to make an inch, even though at a lower resolution it takes far fewer pixels.

Reference:
Pro WPF in C# 2008: Windows Presentation Foundation with .NET 3.5, Second Edition

自由如风 2024-09-06 07:54:01

WPF 使用与设备无关的坐标,这意味着应用程序可以在不同的 DPI 设置下正确且均匀地缩放。

WPF 的另一个非常有用的功能是 ViewBox,它可用于创建可扩展的应用程序。尝试以下操作。

<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Width="300" Height="300">
    <Viewbox Stretch="Uniform">
        <Grid Width="300" Height="300">
            <Button Content="Button" Margin="16,8,0,0" 
                    Width="104" Height="32" 
                    HorizontalAlignment="Left" 
                    VerticalAlignment="Top" />
            <CheckBox Content="CheckBox" Margin="136,8,0,0" 
                      Width="112" Height="24" 
                      HorizontalAlignment="Left" VerticalAlignment="Top" />
        </Grid>
    </Viewbox>
</Window>

这个简单的例子有点偏离窗口标题栏和边框的原因,但你明白了。调整此窗口大小时,内容会均匀缩放,因此在任何分辨率下看起来都相同。

WPF uses device-independent coordinates which means applications scale correctly and uniformly at different DPI settings.

Another very useful feature of WPF is the ViewBox which can be used to create a scalable application. Try the following.

<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Width="300" Height="300">
    <Viewbox Stretch="Uniform">
        <Grid Width="300" Height="300">
            <Button Content="Button" Margin="16,8,0,0" 
                    Width="104" Height="32" 
                    HorizontalAlignment="Left" 
                    VerticalAlignment="Top" />
            <CheckBox Content="CheckBox" Margin="136,8,0,0" 
                      Width="112" Height="24" 
                      HorizontalAlignment="Left" VerticalAlignment="Top" />
        </Grid>
    </Viewbox>
</Window>

This simple example is a little off cause of the window title bar and border but you get the idea. When this window is resized, the content scales uniformly so it looks the same at any resolution.

茶花眉 2024-09-06 07:54:01

您可以将 WPF 用于您的应用程序。您在表单上创建的每个控件都将采用不同的屏幕分辨率。

WPF 声称的主要好处之一是“分辨率独立性”。通常,这种好处是用相对模糊的术语来描述的,导致人们相信这意味着相同的 WPF 窗口将以相同的尺寸显示在任何显示器上,无论显示器设置的分辨率如何。

You can use WPF for your application. Every control that you create on a form will be the in different screen resolutions.

One of the main claimed benefits of WPF is “resolution independence”. Often this benefit is described in relatively vague terms leading people to believe that it means that the same WPF window will display on any monitor at the same size regardless of the resolution at which that monitor is set.

坏尐絯℡ 2024-09-06 07:54:01

我认为这意味着不同分辨率下的比例应该相同。这并不意味着应用程序将在内部调整其窗口大小以适应新的分辨率。但这并不普遍。

另一件非常重要的事情是它所带来的背景。例如,对网络应用程序有不同的期望,这可能会根据分辨率改变布局或页面大小。 视频游戏,可能会渲染根据屏幕分辨率和宽高比,差异很大。以及我已经提到过的常规Windows 应用程序 (GUI)。

I think it means that the proportions should be the same, on different resolutions. It doesn't mean the application will resize its windows internally to adjust to the new resolution. But this is not universal.

Another very important thing to mention, is the context this is brought on. For example there are different expectations for a web application, which may change the layout or page size depending on the resolution. Video games, which may render things very differently depending on the screen resolution and aspect. And regular windows applications (GUI), which I already mentioned.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文