Im using DrawToBitmap
to save some labels as image. I would like to know how to change the resolution of these images, is there a way? Say I have a label with a
Something like this will do the job, just increase font size used from label:
Bitmap CreateBitmapImage(string text, Font textFont, SolidBrush textBrush)
{
Bitmap bitmap = new Bitmap(1, 1);
Graphics graphics = Graphics.FromImage(bitmap);
int intWidth = (int)graphics.MeasureString(text, textFont).Width;
int intHeight = (int)graphics.MeasureString(text, textFont).Height;
bitmap = new Bitmap(bitmap, new Size(intWidth, intHeight));
graphics = Graphics.FromImage(bitmap);
graphics.Clear(Color.White);
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
graphics.DrawString(text, textFont, textBrush,0,0);
graphics.Flush();
return (bitmap);
}
you can achieve this by increasing the value of second parameter of System.Drawing.Font.
this.label1.Font = new System.Drawing.Font("Baskerville Old Face", 1000F);