![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| 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 | |||