WPF 绘图悖论
两个具有相同半径的椭圆(视觉上)怎么可能具有相同的半径?
在下图中,黑色和红色椭圆具有相同的 RadiusX...但是请看图片!
<GeometryDrawing Brush="Red">
<GeometryDrawing.Pen>
<Pen Brush="Yellow" Thickness="1"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry x:Name="MediumCircle"
Center="0,0" RadiusX="4" RadiusY="4" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="Black">
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry x:Name="SmallCircle"
Center="0,0" RadiusX="4" RadiusY="2"/>
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
How is it possible, that 2 ellipses with the same Radius where not (visually) with the same Radius?
in the image bellow, Black and Red ellipses has the same RadiusX... but look on the picture!
<GeometryDrawing Brush="Red">
<GeometryDrawing.Pen>
<Pen Brush="Yellow" Thickness="1"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry x:Name="MediumCircle"
Center="0,0" RadiusX="4" RadiusY="4" />
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing Brush="Black">
<GeometryDrawing.Geometry>
<GeometryGroup>
<EllipseGeometry x:Name="SmallCircle"
Center="0,0" RadiusX="4" RadiusY="2"/>
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一个有描边边框,另一个没有。您会注意到半径与描边边框的中心对齐。
One has a stroked border and the other doesn't. You'll notice the radius lines up with the center of the stroked border.
看来厚度是罪魁祸首。使两者相同。
Looks like the thickness is to blame. Make them the same for both.
我想我找到了答案,但不确定...椭圆的厚度并不完全围绕椭圆。如果我们将厚度设置为 4,我们将只能看到 2 个像素的椭圆,如果我们设置为 8,我们将不再看到红色圆圈...
I think I found the reply, but not sure... The Thickness of the ellipse goes not totally around the ellipse. If we Set the Thickness to 4 we will see only 2 pixels of ellipse, if we set at 8, we will not see the red circle anymore...