【发布时间】:2011-05-07 13:34:44
【问题描述】:
我想画一个三角形作为边框背景。一种方法是使用 DrawingBrush,但在较小的尺寸下,抗锯齿会扭曲三角形并使其模糊。 如何禁用抗锯齿功能?
<Border>
<Border.Background>
<DrawingBrush>
<DrawingBrush.Drawing>
<GeometryDrawing Brush="Red">
<GeometryDrawing.Geometry>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure IsClosed="True" StartPoint="0,3" IsFilled="True">
<PathFigure.Segments>
<LineSegment Point="3,0" />
<LineSegment Point="6,3" />
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</Border.Background>
</Border>
我已尝试在所有可能的元素上设置 RenderOptions.EdgeMode="Aliased" 和 SnapsToDevicePixels="true",但没有奏效...
编辑:
这就是 Width=17 时绘制的三角形的样子;高度=12(放大到 800%):
如您所见,边缘已消除锯齿。禁用抗锯齿的所有常用选项似乎都不起作用...
【问题讨论】:
-
您能否提供一张截图(以及您使用的宽度/高度值)?
-
@H.B.检查我的帖子的编辑
标签: wpf