Dear all,
Is it possible to have two images of different sizes in a single picture box in C#? I'm using VS2008.
Thanks
Emyr
-
-
Depends how.
The PictureBox does have the BackgroundImage property, so you could kludge something together like that.
Otherwise, it really isn't painful to put two images together yourself like so:private Bitmap LoadTwoImages() {
Bitmap image1 = GetBitmap1();
Bitmap image2 = GetBitmap2();
Bitmap combined = new Bitmap( image1.Width + image2.Width, image1.Height > image2.Height ? image1.Height : image2.Height );
using(Graphics g = Graphics.FromImage(combined)) {
g.DrawImage(image1, 0, 0);
g.DrawImage(image2, 0, image1.Width);
}
return combined;
}
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.