I have got a System.Drawing.Bitmap in my code.
The width is fix, the height varies.
What I want to do, is to add a white border around the bitmap, with about 20 pixel, to all 4 edges.
How would this work?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could draw a rectangle behind the bitmap. The width of the rectangle would be (Bitmap.Width + BorderWidth * 2), and the position would be (Bitmap.Position – new Point(BorderWidth, BorderWidth)). Or at least that’s the way I’d go about it.
EDIT:
Here is some actual source code explaining how to implement it (if you were to have a dedicated method to draw an image):