wpf - Why does UseLayoutRounding not seem to work with Viewbox? -


I am trying to write a tile-based game in WPF 4. I want to scale the sports board to fit in the window, so I am using a viewbook; But I want every tile on a nice, crispy pixel border. I may be wrong, but my understanding is that it is considered to be the new UseLayoutRounding property - but the way I expect it, it is not working.

Here is a window that shows this issue:

   & lt; Rectangle canvas. Lift = "200" canvas. Top = "100" width = "100" height = "100" = "gray" /> & lt; / Canvas & gt; & Lt; / Viewbox & gt; & Lt; / Window & gt;  

Two rectangles are imminent, but because of the sub-pixel coordinates (as a result of the scaling of the viewbox), I end up with a deep gray border between them, this is what I'm trying to get rid of - I want them to mix together.

But UseLayoutRounding does not seem to affect this. I have tried to set the UseLayoutRounding = "True" on the window, view box, canvas, rectangles - I have tried to put it in all at one time, there is no effect on seam.

What am I missing (or misunderstanding)? How can I get a layout rounding to work with a viewbox?

snaptwoDevice pixel = true is what you want

  & lt; Viewbox snap toolwise pixel = "true" & gt; & Lt; Canvas width = "1000" height = "1000" & gt; & Lt; Rectangle canvas.lift = "100" canvas Top = "100" width = "100" height = "100" = "gray" /> & lt; Rectangle canvas. Lift = "200" canvas. Top = "100" width = "100" height = "100" = "gray" /> & lt; / Canvas & gt; & Lt; / Viewbox & gt;  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -