Tuesday, 27 August 2013

Text in label not shown proper in window form

Text in label not shown proper in window form

i work on one project in that i make my window from transparent. in that
one label in that label text set by dynamically. after set the text it
shown like below image.

in that 88 is the label which is set text by dynamically.
and the hello wo is try by me as a part of solution but it not work and it
code is below.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Bitmap bitmap = new Bitmap(this.Width, this.Height,
System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bitmap);
g.Clear(Color.Empty);
g.TextRenderingHint =
System.Drawing.Text.TextRenderingHint.AntiAlias;
g.DrawString("hello world", new Font(this.Font.FontFamily, 48),
Brushes.Blue, new Point(50, 50));
e.Graphics.DrawImage(bitmap, new Point(0, 0));
}
but is also look like label text. i want label text like clear type text
please help me for it.

No comments:

Post a Comment