I have following problem. I want to make some graphics in c# windows form. I want to read bitmap to my program and after it write some text on this bitmap. In the end I want this picture load to pictureBox. And it's my question. How can I do it?
example, how must it work:
Bitmap a = new Bitmap(@"path\picture.bmp");
a.makeTransparent();
// ? a.writeText("some text", positionX, positionY);
pictuteBox1.Image = a;
Is it possible do to?
Very old question, but just had to build this for an app today and found the settings shown in other answers do not result in a clean image (possibly as new options were added in later .Net versions).
Assuming you want the text in the centre of the bitmap, you can do this:
References
If you want wrap your text, then you should draw your text in a rectangle:
See: https://msdn.microsoft.com/en-us/library/baw6k39s(v=vs.110).aspx
You need to use the
Graphics
class in order to write on the bitmap.Specifically, one of the
DrawString
methods.