0

In the following code I have two rectangles with a width of 71.93, one of them in position left = 0 and the next one in position 71.93, so it should be completely attached to the first one.

The problem is that when I run the code, a separation line appears between the two

I can solve it with Math.Floor but I would like to understand what is the problem and the best solution

enter image description here

What I hope is that if I position a control in a left position that is the same right position of another control, they will be perfectly glued

i81mi
  • 1
  • 1
    The problem is [subpixel rendering](https://en.wikipedia.org/wiki/Subpixel_rendering). The floating point coordinates have somehow to be mapped to integer pixels. At the edges, such shapes may be rendered with a certain degree of transparency. To avoid this, you may set the properties `UseLayoutRounding` and `SnapsToDevicePixels`. Since shapes are rendered individually, they are not "*perfectly glued*". – Clemens Aug 02 '23 at 05:54
  • @Clemens UseLayoutRounding and SnapsToDevicePixels fixes the problem, thanks a lot – i81mi Aug 02 '23 at 10:16

0 Answers0