Workaround for draw rectangle bug

This commit is contained in:
Jaex 2013-11-09 03:26:15 +02:00
parent f7a870b2d7
commit f983bae51f

View file

@ -32,9 +32,12 @@ public static class GraphicsExtensions
{ {
public static void DrawRectangleProper(this Graphics g, Pen pen, Rectangle rect) public static void DrawRectangleProper(this Graphics g, Pen pen, Rectangle rect)
{ {
rect = rect.SizeOffset(-1); if ((int)pen.Width == 1)
{
rect = rect.SizeOffset(-1);
}
if (rect.Width > 1 && rect.Height > 1) if (rect.Width > 0 && rect.Height > 0)
{ {
g.DrawRectangle(pen, rect); g.DrawRectangle(pen, rect);
} }