SarahBenjamin Posted October 22, 2007 Report Share Posted October 22, 2007 How can I have a portion of another bitmap put as a background to the text of another bitmap? In other words, I want to show text from both the bitmaps at the same place, but one on the front and another at the back. Thanks -Sarah Quote Link to comment Share on other sites More sharing options...
maximop Posted October 23, 2007 Report Share Posted October 23, 2007 I am not sure if I understood your question correctly but to draw text on an existing image, you will have to create a graphics object with a new bitmap. You can try the following: Rectangle r = new Rectangle(10, 10, 300, 150);Image img = Image.FromFile("D:\\Beach.jpg"); Bitmap bmp = new Bitmap(300, 150);Graphics g = Graphics.FromImage((Image)bmp); g.DrawImage(img, r);g.DrawString("This is a test", new Font("Arial", 12, FontStyle.Bold), Brushes.Black, 15, 15,StringFormat.GenericTypographic); g.Dispose(); Then if you have a picture box, for example, you can pass the new bitmap to it: pictureBox1.Image = ( Image)bmp; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.