Denis535
Denis535

Reputation: 3590

WPF - How to make thickness be independent on scale?

I draw shapes programmatically, via the DrawingContext. And I want shapes have a fixed thickness independent on the RenderTransform's scale.

Can I do it?

Upvotes: 0

Views: 486

Answers (1)

Clemens
Clemens

Reputation: 128061

Use the DrawGeometry method to draw your shapes as geometries. You could then apply the transform to their Transform property.

var transform = new ScaleTransform(...);
var ellipse = new EllipseGeometry();
...
ellipse.Transform = transform;
drawingContext.DrawGeometry(null, pen, ellipse);

You can even modify the transform after drawing the shapes.

Upvotes: 1

Related Questions