protected void DrawText(Graphics graphics, string curLine, int xPos, int yPos, int width,
int height)
{
graphics.TextRenderingHint = TextRenderingHint.SystemDefault;
graphics.SmoothingMode = SmoothingMode.AntiAlias;
TextFormatFlags flags = TextFormatFlags.PreserveGraphicsTranslateTransform;
Point p = new Point(xPos, yPos);
TextRenderer.DrawText(
graphics, curLine,
ScaleFont(graphics, TextFont),
ScaleRect(graphics, xPos, yPos, width, height),
TextColor, flags);
}
float Scale=1.3;
private Rectangle ScaleRect(Graphics g, int xPos, int yPos, int width, int height)
{
return new Rectangle(
(int)Math.Ceiling(xPos * Scale),
(int)Math.Ceiling(yPos * Scale),
(int)Math.Ceiling(width * Scale),
(int)Math.Ceiling(height * Scale));
}
private Font ScaleFont(Graphics g, Font font)
{
return new Font(
font.FontFamily, font.SizeInPoints * Scale, font.Style, GraphicsUnit.Point,
font.GdiCharSet, font.GdiVerticalFont);
}