I'm trying to draw a string on an image and display it on a picturebox and I'm using the DrawString function in the .Net graphics library.
Problem is the function is drawing on two images - (the image that I want it to draw on, and the original image which I do not want it to draw on).
Here's the code:
Image img = new Bitmap(1, 1);
img = original;
drawing = Graphics.FromImage(img);
Font priceFont = new Font("Calibri (Body)", 16.0f, FontStyle.Bold);
drawing.DrawString(textBox1.Text, priceFont, brush, 410f, 660);
drawing.Save();
drawing.Dispose();
pictureBox1.BackgroundImage = null;
pictureBox1.BackgroundImage = img;
pictureBox2.BackgroundImage = null;
pictureBox2.BackgroundImage = original;
picbox1 and picbox2 are displaying the same exact results as if the object 'drawing' is drawing on both images. Any ideas how I can make it draw on only the 'img' object and not 'original' too?
The above two lines cause this issue.
You shoud be using it like this