Fit two digit numbers to step label

This commit is contained in:
Jaex 2016-05-23 02:53:10 +03:00
parent c7a7a45fe4
commit ebdcc7273d

View file

@ -73,9 +73,20 @@ public override void OnDraw(Graphics g)
if (Rectangle.Width > 20 && Rectangle.Height > 20)
{
int fontSize = Math.Min(Rectangle.Width, Rectangle.Height) - 10;
int offset;
using (Font font = new Font("Verdana", fontSize, GraphicsUnit.Pixel))
if (Number > 9)
{
offset = 15;
}
else
{
offset = 10;
}
int fontSize = Math.Min(Rectangle.Width, Rectangle.Height) - offset;
using (Font font = new Font("Arial", fontSize, GraphicsUnit.Pixel))
using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center })
{
g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;