Re: Multiple images in a PictureBox Control

Tech-Archive recommends: Fix windows errors by optimizing your registry




<prynhart@xxxxxxxxx> skrev i en meddelelse
news:1177026574.989051.119910@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a PictureBox Control which is 96*96 pixels. I want to display
nine 32*32 pixel bitmaps in this control arranged in a 3X3 square. How
can I do this ? All the examples I've seen load only one image in the
PictureBox.

The code:

board.ClientSize = new Size(96, 96);
board.Image = (Image)image1;

displays image1 in the top left hand corner. How can I display images
2 - 9 ?

Thanks,

Patrick



board..Paint += new
System.Windows.Forms.PaintEventHandler(this.pictureBox1_Paint);

....

private void pictureBox1_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
// Create Point for upper-left corner of image1.
Point P1 = new Point(0, 0);
e.Graphics.DrawImage(image1, P1);

Point P2 = new Point(0, 32);
e.Graphics.DrawImage(image2, P2);

//.... and so forth

}


Best regards
Michael Weber


.