Archit Patel

Archit Patel

  • NA
  • 14
  • 3.4k

Text in label not shown proper in window form

Aug 28 2013 2:00 AM

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.

My Window Form

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.


Answers (7)