Pixel behaviour of FillRectangle and DrawRectangle

前端 未结 3 1351
挽巷
挽巷 2020-12-01 21:26

nearly every time I use Graphics.DrawRectangle or Graphics.FillRectangle (the int versions) I seem to miss the pixels on the right and

3条回答
  •  孤街浪徒
    2020-12-01 21:39

    The difference in behavior is due to the somewhat counter intuitive fact that these two algorithms do completely different things.

    DrawRectangle draws four lines in the shape of a box. FillRectangle produces a W*H clump of filled in pixels. From this it's easy to see the reason for the difference in behavior. Namely the wrongness of the assumption of similarity. Drawing four lines is quite different than producing a boxlike clump of pixels.

提交回复
热议问题