i绘制x直线。相同的厚度等。但是每四行看起来都明显不同 - 较薄。
<Canvas Name="Canvas">
<Line X1="100" Y1="100" X2="500" Y2="100" Stroke="Black" StrokeThickness="1" RenderOptions.EdgeMode="Unspecified"/>
<Line X1="100" Y1="125" X2="500" Y2="125" Stroke="Black" StrokeThickness="1" RenderOptions.EdgeMode="Unspecified"/>
<Line X1="100" Y1="150" X2="500" Y2="150" Stroke="Black" StrokeThickness="1" RenderOptions.EdgeMode="Unspecified"/>
<Line X1="100" Y1="175" X2="500" Y2="175" Stroke="Black" StrokeThickness="1" RenderOptions.EdgeMode="Unspecified"/>
<Line X1="100" Y1="200" X2="500" Y2="200" Stroke="Black" StrokeThickness="1" RenderOptions.EdgeMode="Unspecified"/>
<Line X1="100" Y1="225" X2="500" Y2="225" Stroke="Black" StrokeThickness="1" RenderOptions.EdgeMode="Unspecified"/>
<Line X1="100" Y1="250" X2="500" Y2="250" Stroke="Black" StrokeThickness="1" RenderOptions.EdgeMode="Unspecified"/>
<Line X1="100" Y1="275" X2="500" Y2="275" Stroke="Black" StrokeThickness="1" RenderOptions.EdgeMode="Unspecified"/>
<Line X1="100" Y1="300" X2="500" Y2="300" Stroke="Black" StrokeThickness="1" RenderOptions.EdgeMode="Unspecified"/>
</Canvas>
渲染选项是别名还是未指定。两个输出都显示并非相同的线路。我什至将Windows DPI设置为100%,看起来仍然相同。
如何修复?有人经历过吗?
尝试在Canvas
上启用SnapsToDevicePixels
。
<Canvas Name="Canvas" SnapsToDevicePixels="True">
这将减少抗缩化的伪影并确保在像素边界上绘制线条。