serhio
serhio

Reputation: 28586

WPF Drawing Paradox

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!
alt text

<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>

Upvotes: 2

Views: 163

Answers (3)

serhio
serhio

Reputation: 28586

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...

Upvotes: 0

Ot&#225;vio D&#233;cio
Ot&#225;vio D&#233;cio

Reputation: 74270

Looks like the thickness is to blame. Make them the same for both.

Upvotes: 0

Dan Bryant
Dan Bryant

Reputation: 27495

One has a stroked border and the other doesn't. You'll notice the radius lines up with the center of the stroked border.

Upvotes: 1

Related Questions