I need to convert text to image, using specified fonts, size, etc. Looks like everything is ok when using standard DrawString method but, when I'm trying to do it under Windows 7 I have my picture blurred.
this is a screenshot from Windows XP / Windows 2008 server
http://testmyblog.ho.ua/pictures/xp.png
and this is from Windows 7
http://testmyblog.ho.ua/pictures/7.png
Also I tried to play with System.Drawing.Imaging.Encoder.Quality;
but even with max value of EncoderParameter blur effect doesn't disappear.
I have no idea where is the problem, hope that you will be able to help.
Loading
Kirtan PatelPosted Nov 20, 2009, 9:52 PM
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
Brush b = new SolidBrush(Color.Black);
//this is to Draw Antialiaced Clean String
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
g.DrawString("Kirtan", new Font(FontFamily.GenericSansSerif, 50), b, new Point(200, 50));
}
Lalit MPosted Nov 25, 2009, 3:17 AM
you can try this code for Convert text to image in c# using System.Drawing namespace.
Here we create a bitmap image and use its Graphics property to convert text passed to image and place the image in a picture box.
Kirtan PatelPosted Nov 25, 2009, 3:13 AM
The Drawing you are Talking about is Vector Drawing. basically Antialiase Feature can make Drawing smoother than it looks
so when you zoom your image in windows form with button actually yo need to redraw it so use fills that image quality is not
reduced after zooming :)
OlegPosted Nov 25, 2009, 2:58 AM
I tried this solution, but it only removes colored pixels from picture, blur effect doesn't disappear. The important point that I need to use font size from 5 to 20.
Here is a picture with size 7:
http://img214.imageshack.us/img214/4670/fromfile.png
I tried to draw text in the pictureBox (probably the problem was in exporting to the file or something) but the picture looks the same as in file.
http://img214.imageshack.us/img214/9834/fromform.png