WPF显示图像,为什么会出现误差?
例如:我的Image大小设定为20*20像素,但是,运行显示的时候,Image却变为:20*21像素了。为什么会这样?
是什么原因带来了控件大小的误差? --------------------编程问答-------------------- 发现不只是Image控件会这样,如Button等其他控件,都有可能出现这种情况。。。 --------------------编程问答-------------------- 你用viewbox了? --------------------编程问答-------------------- 没有用ViewBox。发现,任何控件,都会有一个像素的误差。这是什么原因?
就简单的代码如下:
最终运行时,Boder在屏幕上显示却是21*20像素。
<Window x:Class="Test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow">
<Grid>
<Border Width="20" Height="20" Background="Green" BorderThickness="0" BorderBrush="Transparent"></Border>
</Grid>
</Window>
--------------------编程问答-------------------- 你怎么确定范围的? --------------------编程问答-------------------- 你print的?
补充:.NET技术 , C#