Fix for size calculations, an exception occured when the size is negative.

This commit is contained in:
RKrom 2014-06-03 12:42:01 +02:00
parent e75925018b
commit 5a96d6f3eb

View file

@ -118,7 +118,7 @@ namespace Greenshot.Drawing {
EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
}
using (FontFamily fam = new FontFamily(FontFamily.GenericSansSerif.Name)) {
float factor = (((float)Width / DefaultSize.Width) + ((float)Height / DefaultSize.Height)) / 2;
float factor = (((float)rect.Width / DefaultSize.Width) + ((float)rect.Height / DefaultSize.Height)) / 2;
_font = new Font(fam, 16 * factor, FontStyle.Bold, GraphicsUnit.Pixel);
TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, _font);
}