如果我有一個System.Drawing.Bitmap具有相同的尺寸,例如100×100,50×50,我想利用這個代碼的單個字符畫:c#system.drawing計算一個字符的字體大小以填充一個正方形圖像
StringFormat stringFormat = new StringFormat();
stringFormat.Alignment = StringAlignment.Center;
stringFormat.LineAlignment = StringAlignment.Center;
font = new Font(_fontName, _fontSize, _fontStyle);
GraphicsPath path = new GraphicsPath();
path.AddString("A", font.FontFamily, (int)font.Style, font.Size, rect, stringFormat);
我怎麼會去計算_fontSize值,使其緊密配合圖像的尺寸內?
您'll必須使用固定寬度的字體爲,可能比計算字符寬度更容易。 – Shai 2012-01-29 07:38:22