以中心为点画圆 - 其中
Draw circle with point on center - where
我想在XAML/WPF画一个中心点的圆并使用这样的代码:
<Ellipse Name="Circle"
Canvas.Left="4.88"
Canvas.Top="15.095"
Width="9.14"
Height="9.14"
Stroke="Red"
StrokeThickness="0.1" />
<Ellipse Name="Point"
Canvas.Left="9.2"
Canvas.Top="19.415"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="0.5"
Height="0.5"
Fill="Red"
Stroke="Red"
StrokeThickness="0.1" />
但是点不在圆心。我哪里弄错了?
椭圆元素未居中。最好使用带有 EllipseGeometry 的 Path 元素:
<Path Name="Circle" Stroke="Red" StrokeThickness="0.1">
<Path.Data>
<EllipseGeometry Center="9.45,19.665" RadiusX="4.57" RadiusY="4.57"/>
</Path.Data>
</Path>
<Path Name="Point" Fill="Red">
<Path.Data>
<EllipseGeometry Center="9.45,19.665" RadiusX="0.25" RadiusY="0.25"/>
</Path.Data>
</Path>
我想在XAML/WPF画一个中心点的圆并使用这样的代码:
<Ellipse Name="Circle"
Canvas.Left="4.88"
Canvas.Top="15.095"
Width="9.14"
Height="9.14"
Stroke="Red"
StrokeThickness="0.1" />
<Ellipse Name="Point"
Canvas.Left="9.2"
Canvas.Top="19.415"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="0.5"
Height="0.5"
Fill="Red"
Stroke="Red"
StrokeThickness="0.1" />
但是点不在圆心。我哪里弄错了?
椭圆元素未居中。最好使用带有 EllipseGeometry 的 Path 元素:
<Path Name="Circle" Stroke="Red" StrokeThickness="0.1">
<Path.Data>
<EllipseGeometry Center="9.45,19.665" RadiusX="4.57" RadiusY="4.57"/>
</Path.Data>
</Path>
<Path Name="Point" Fill="Red">
<Path.Data>
<EllipseGeometry Center="9.45,19.665" RadiusX="0.25" RadiusY="0.25"/>
</Path.Data>
</Path>