Posted By: Emyr | Jul 3rd @ 2:59 PM
page 1 of 1
Comments: 1 | Views: 524
Emyr
Emyr
In front of my computer....
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
W3bbo
W3bbo
The Master of Baiters
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;
}
page 1 of 1
Comments: 1 | Views: 524