我element(StrokeThickness="1" SnapsToDevicePixels="True")
在Grid中使用Path .我想调整窗口大小,Grid元素由Viewbox元素包装.
问题
当我调整窗口大小时,Path会消失一段时间.如果我将SnapsToDevicePixels变为false,则Path元素可能会模糊,这不是我想要的.
如何避免单个像素线消失?
XAML代码:
<Window x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="207" Width="475">
<Viewbox Stretch="Fill">
<Grid Height="320" Width="517">
<Path Data="M0,0 H1 z" StrokeThickness="1" Stroke="Black" Margin="72,73,79,218" Stretch="Fill" SnapsToDevicePixels="True" MinHeight="1"/>
</Grid>
</Viewbox>
Run Code Online (Sandbox Code Playgroud)
可惜我没有声誉来发布运行时效果.