-
22-08-2019 - |
题
我维持我正在重新写入的.Net的触摸屏应用程序。经过多年的触摸屏的分辨率大大提高。不仅分辨率高,但像素也更加密集使其更难看到/操作触控按键。
是否有与WPF办法迫使应用程序窗口是按比例的自己作为分辨率/像素密度的变化更大?我宁愿没有返工这些屏幕每隔几年。
解决方案
是的,有
您可以用包裹WPF的视框的容器。这里不用的示例:
<Window x:Class="TestWPF.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Viewbox Stretch="Uniform">
<StackPanel Background="Azure" Height="400" Width="300" Name="stackPanel1" VerticalAlignment="Top">
<Button Name="testBtn" Width="200" Height="50">
<TextBlock>Test</TextBlock>
</Button>
</StackPanel>
</Viewbox>
</Window>
截图:
本主题,获取更多的信息。
其他提示
这是默认行为,每个WPF“像素”是一英寸的1/96,而不是实际的像素(即现在的唯一问题是,几乎所有的屏幕被设置为96DPI无论画面实际分辨率的)。
不隶属于 StackOverflow