This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I would like to have a pixel perfect grid (1px lines with full opacity) in 100% view of a DiagramSurface that is using a IntervalLineSnapLineDrawing.
Is it possible to change the opacity and the thickness of MainPen and IntervalPen? Setting Thickness and the opacity via the color hexcode seem to have no effect. It seems like there is a default opacity applied to all grid lines. |
|
|
Hello The reason why the lines look semi-transparent is because of anti-aliasing. By default, WPF renders lines with anti-aliasing, this is great for things like fonts and shapes, but not so much for grid lines. In most cases, you can disable anti-aliasing on parts of the visual tree. Unfortunately, this can not be done for brushes which is how the grid lines in the Diagram Surface are rendered (because this is the fastest way to draw them). I am however exploring a hack that may allow us to force the brush to render pixel perfect lines. I can't promise it will work, but I'll let you know tomorrow if it does. Jason Fauchelle |
|
|
Hey Jason, thank you for your quick response. Ok, that explains why setting "SnapsToDevicePixels" of the DiagramSurface to "true" didn't affect the grid lines. But "hack that may allow us all to …" sounds great. I've got my fingers crossed! :-) Best regards Matthias |
|
|
Hello Matthias I managed to get the grid lines snapping as best as I possibly could considering the circumstances. In order to get the best results, I recommend trying to make the widths and heights of controls within the window integers. For example, when I was testing this out, the vertical lines were perfect, but some of the horizontal lines near the middle of the diagram were fuzzy. This was because the ToolBar I had at the top of the application had an auto-calculated non-integer height. When I forced this to be an integer, all the lines became pixel perfect. This update will be available in the next nightly build. The next nightly build will be available at around 1200 GMT. Nightly builds can be downloaded from here: http://www.mindscapehq.com/products/wpfdiagrams/nightly-builds Jason Fauchelle |
|
|
Hello Jason, sounds awesome. We'll try to include the nightly build as fast as we can. Can't wait to see it in action. Thanks for your help and the tips! Best regards from Stuttgart Matthias |
|