Stroke Thickness
#2
Unfortunately WPF does not support scale invariant thickness. This is supported in GDI+ and is very useful for vector drawing applications. In WPF the line thickness is always scaled.

There is already a WPF feature request to add this also to WPF - please vote for it on http://dotnet.uservoice.com/forums/40583...r-graphics

However it is probably also possible to implement this in the current version of WPF with manually updating the StrokeThickness on all shapes.

With ZoomPanel this can be done this way:

The current zoom factor can be get from the current Viewbox property from ZoomPanel.

When Width and Height of Viewbox is 1, than we are showing 100% of the image (Viewbox = (0 0 1 1). Viewbox is (0 0 0.5 0.5) than we are showing just the upper 1/4 of the image - here the x scale is factor 2 and y scale is 2 - the overall scale is 4.

So the zoom factor can be calculated with 1 / (Viewbox.Width * Viewbox.Height).


You can subscribe to ViewboxChanged event on ZoomPanel to be informed about any Viewbox changes.

Now you will have to adjust all the stroke thicknesses regarding the zoom factor.

I did not try this yet.
I and probably some others would be very interested in knowing how this worked, so please post a feedback.
Andrej Benedik
  


Messages In This Thread
Stroke Thickness - by thesly - 04-14-2011, 11:48 AM
RE: Stroke Thickness - by abenedik - 04-28-2011, 03:16 PM
RE: Stroke Thickness - by thesly - 10-12-2011, 01:42 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)