Border in DrawRectangle

后端 未结 1 1381
难免孤独
难免孤独 2021-02-11 18:57

Well, I\'m coding the OnPaint event for my own control and it is very nescessary for me to make it pixel-accurate.

I\'ve got a little problem with borders of rectangles.

1条回答
  •  梦毁少年i
    2021-02-11 19:20

    You can do this by specifying PenAlignment

    Pen pen = new Pen(Color.Black, 2);
    pen.Alignment = PenAlignment.Inset; //<-- this
    g.DrawRectangle(pen, rect);
    

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