GDI+ .NET: LinearGradientBrush wider than 202 pixels causes color wrap-around

前端 未结 1 1363
Happy的楠姐
Happy的楠姐 2021-01-18 13:37

If i paint a rectangle that is wider than 202 pixels wide with a LinearGradientBrush, i get a color fringe on the left:

1条回答
  •  情话喂你
    2021-01-18 14:26

    Add this statement before the FillRectangle() call:

     e.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
    

    That avoids off-by-one problems due to floating point rounding error.

    0 讨论(0)
提交回复
热议问题