Results 1 to 15 of 15

Thread: Why is text not being displayed correctly

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2004
    Location
    england
    Posts
    598

    Why is text not being displayed correctly

    Hi All,

    I draw some text onto a picture box with the code below but for some reason the text does not get drawn at the position 0,0 why?

    I have attached a image to show the output.

    Code:
    private void button2_Click(object sender, EventArgs e)
            {
     FontFamily fm = new FontFamily("Arial");
                StringFormat st = new StringFormat();
    
                GP.AddString("Hello", fm, 1, 40, new PointF(0, 0), st);
    
    DrawString();
    }
    private void DrawString()
            {
                
    
                Bitmap bat = new Bitmap(pictureEdit1.Width, pictureEdit1.Height);
                Image d = bat;
                Graphics graphics = Graphics.FromImage(d);
                graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
    
                Brush textBrush = new SolidBrush(Color.Black);
    
                graphics.DrawPath(new Pen(textBrush), GP);
               
                pictureEdit1.Image = d;
                pictureEdit1.Refresh();
            }


    Thanks

    Loftty
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width