[UWP]Ellipse and ArcSegment Query

RobDev 401 Reputation points
2022-03-22T15:21:04.23+00:00

Greetings All,

in UWP, if I draw an ellipse with, for example, a Width and Height of 100 and specify the StrokeThickness as, say, 10, what will the diameter of the resulting circle be? Is the curve of the ellipse, drawn with the specified StrokeThickness, draw on the outside of the 100 x 100 circle, making the overall diameter 120 , or is it drawn on the inside of the circle, thus retaining the circle's 100 x 100 dimension?

Likewise, what happens if the same circle, with the same StrokeThickness, is drawn with an ArcSegment?

Kind regards.

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Castorix31 83,206 Reputation points
    2022-03-22T16:07:07.563+00:00

    You can do a test with an Ellipse and a Line with Width = 100 =>

     <Ellipse HorizontalAlignment="Left"  Width="100" Height="100" Margin="10,200,0,0"  Fill="Red" Stroke="Blue" VerticalAlignment="Top"  
                      StrokeThickness="10"/>  
     <Line X1="10" Y1="315" X2="110" Y2="315"  Stroke="Red"   StrokeThickness="10"/>  
    

    185741-ellipse-line.jpg


  2. Roy Li - MSFT 32,731 Reputation points Microsoft Vendor
    2022-03-24T06:58:58.403+00:00

    Hello,

    Welcome to Microsoft Q&A!

    is it drawn on the inside of the circle, thus retaining the circle's 100 x 100 dimension?

    Yes, for Ellipse, the StrokeThickness represents the width of the Shape stroke outline, it's a part inside the shape, not an extra part of the shape. It won't draw on the outside of the shape.

    But it's different for the Path and the ArcSegment. Setting the StrokeThickness of the Path will make the overall diameter bigger. A workaround is setting the Stretch property of the Path, it could help to keep the Path render inside its parent control.

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. RobDev 401 Reputation points
    2022-05-25T15:07:41.29+00:00

    Greetings All,

    it seems that everybody has lost interest in my query and related info so I'm posting my last comment here and marking it as the answer, unless and until someone else can come up with a better one:

    "as far as I can determine, it would seem that for an ArcSegment when the Stretch property is set to 'None', if the path height and width is greater than the drawn result (i.e. ArcSegment Size) then the StrokeThickness extends the inner and outer radius of the ArcSegment (i.e. it draws either side of the defined ArcSegment radius). However, if the ArcSement is defined be the same size as the path width and height and the Stretch property is set is set to something other than 'None', then the ArcSegment StrokeThickness is drawn only on the inside, reducing the inner diameter but retaining the outer diameter."

    Cheers.

    0 comments No comments