Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Invariant Stroke Thickness in WPF

 
 
Old 04-27-2007   #1 (permalink)
MicroDrainage


 
 

Invariant Stroke Thickness in WPF

I am attempting to produce a simple CAD engine using WPF. So far it has
produced very pleasing results and I have a working user control that
harnesses the technology. I render to a Canvas, which is then hosted onto my
user control using the ElementHost.

I have however run into a slight issue when it comes to implementing
Invariant Stroke Thickness. By this I mean that when I zoom in and out I wish
for the line thickness of my UIElements (Lines/Ellipses/Polygon/Text etc) to
remain the same rather than scaling. To Zoom, Pan and Rotate I am setting the
Canvas.RenderTransform() property to a Matrix that has been Scaled,
Transformed and Rotated accordingly. This allows all the movements I require
around the 2D space and has the benefit of making it easy to obtain the
actual co-ordinate if a user-scale other than pixels is used, such as mm, as
the matrix can be inverted. It does however have the downside that when the
image is scaled for a Zoom all the elements also Scale in thickness.

What I am after is someway to keep the Element thickness constant regardless
of the scale. I have found that this can be done on the Path UIElement as you
can apply a scale to this which does not alter its thickness but makes the
element bigger on screen, therefore giving the same affect as scaling.
However this appears to only be possible for the Path element and not Line/
Ellipse/ Polygon/Text etc. I would prefer to use the built in Elements than
attempt to replicate them using a Path if possible. I would also like to
avoid redrawing every element when the scale is changed as this proves to be
very slow and gives no benefits over using GDI. Likewise editing each
element’s stroke thickness when the scale is changed could also prove to be a
slow process.

Is there anyway way to assign an element’s stroke thickness as invariant or
a preferred way of Zooming that prevents the thickness from scaling?


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
thickness of pane boundaries Vista General
String handling: ordinal or invariant or current-culture? PowerShell
Change the Border thickness ! SEE HERE Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46