0

Hi,

Consider this code:

Ellipse myCircle = new Ellipse();
myCircle.Width = 400;
myCircle.Height = 400;
myCircle.Stroke = Brushes.PeachPuff;
myCircle.StrokeThickness = 25;
myCircle.ToolTip = "Bold Circle";
Canvas.SetTop(myCircle, 0);
Canvas.SetLeft(myCircle, 0);
canvas.Children.Add(myCircle);

Ellipse myCircle2 = new Ellipse();
myCircle2.Width = 400;
myCircle2.Height = 400;
myCircle2.Stroke = Brushes.Black;
myCircle2.StrokeThickness = 1;
Canvas.SetTop(myCircle2, 0);
Canvas.SetLeft(myCircle2, 0);
canvas.Children.Add(myCircle2);

I see that myCircle2 lying at the edge of myCircle.
How can I define the stroke style of myCircle such that myCircle2 will lie in the middle of myCircle ?

Thanks !

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by moroshko
0

I see that myCircle2 lying at the edge of myCircle.
How can I define the stroke style of myCircle such that myCircle2 will lie in the middle of myCircle ?

I'm not aware of any way to change the stroke to make it display the way I think you want it to. I think you are going to need to change the definition of myCircle2 so that it's centered on the same point, but has a smaller radius, for example:

Ellipse myCircle2 = new Ellipse();
myCircle2.Width = 375;
myCircle2.Height = 375;
myCircle2.Stroke = Brushes.Black;
myCircle2.StrokeThickness = 1;
Canvas.SetTop(myCircle2, 12.5);
Canvas.SetLeft(myCircle2, 12.5);
canvas.Children.Add(myCircle2);
0

Yes, you are right.
The same way I can enlarge myCircle.
Thanks !

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.