WinRT Ellipse Stroke Thickness not consistent

281 views Asked by At

I want to draw in WinRT (Windows 8.1) multiple circles with same size and stroke thickness. If I use Ellipse elements and set on all elements the same values (no fill color) I get circles with different stroke thickness. But they should all have the same stroke thickness. How can this be fixed?

The Ellipse is created programmatically and then added as child element to a Grid

Ellipse e = new Ellipse();
e.Stroke = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
e.StrokeThickness = 1;
e.Width = 30;
e.Height = 30;
1

There are 1 answers

1
Chubosaurus Software On BEST ANSWER

You're not seeing different StrokeThickness what you are seeing is 2 or more Ellipse on top of each other. But you're probably wondering why it appears "Thicker", it is because antialiasing on the outer/inner edges of the ellipse.

When you have two or more they will blend with each other, so the antialiasing will appear thicker because the semi-transparent edges will AlphaBlend, if you have enough layers then all outer/inner edges will lose its transparency and eventually will become a very jagged Ellipse.

If you can figure how to turn antialias off like WPF's SnapsToDevicePixels then you won't have this effect, but you will have a jagged Ellipse.