-
October 1st, 2013, 12:20 PM
#1
DrawString function
Dear code gurus,
I am using a "DrawString" function to display text in bitmap. For whatever reason, the text displayed have some "shading" as on the picture below. In this picture I have used Arial 20pt regular font and "Black" brush. You may not see the problem due to the size of the picture, but if you "blow it up" you will see that different shades are used to draw the text.
What am I doing wrong? What should I fix to display the text only in black on my bitmap, no additional colors.
Thank you for your help.
-
October 1st, 2013, 12:23 PM
#2
Re: DrawString function
Originally Posted by balexei
What am I doing wrong?
What are you doing? Without a code snippet, it's going to be hard to help you.
-
October 1st, 2013, 12:56 PM
#3
Re: DrawString function
Arjay,
Sorry, below is my code:
Code:
public Bitmap BitmapForLabel(string Text, Font mFont, Point p, int w, int h)
{
Bitmap MyLabel = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format16bppRgb555);
Graphics myGraphics = Graphics.FromImage(MyLabel);
Brush myBrush = new SolidBrush(Color.Black);
myGraphics.DrawString(Text, mFont, myBrush, p);
return MyLabel;
}
-
October 1st, 2013, 01:56 PM
#4
Re: DrawString function
This is just anti-aliasing. You can control how text is rendered using the Graphics.TextRenderingHint property
-
October 1st, 2013, 04:01 PM
#5
Re: DrawString function
Originally Posted by Peter_B
Thank you very much!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|