我有代码:
<Canvas>
<Image Canvas.Left="0" Canvas.Top="0">
<Image.Source>
<DrawingImage>
<DrawingImage.Drawing>
<GeometryDrawing>
<GeometryDrawing.Pen>
<Pen Brush="Black" Thickness="1" />
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<LineGeometry StartPoint="50,50" EndPoint="100,50">
</LineGeometry>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingImage.Drawing>
</DrawingImage>
</Image.Source>
</Image>
</Canvas>
我希望它可以是从 50,50 到 100,50 的一条线,但最后它从 0,0 到 50,0 我似乎StartPoint
没有GeometryDrawing
意义?有谁知道解决方案?我不想修改Canvas.Left
and Canvas.Top
。