Click here to Skip to main content
15,901,853 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.and when i click a point on
that that should be zoomed.so that it will not lose pixel as there are 3*3 images.
as i will take which images and how much portion from each image is displayed
Posted
Updated 21-Dec-11 6:23am
v2

Why don't you assemble the nine individual bitmaps into a single image, and work with that instead?
 
Share this answer
 
Comments
M Kiran Kumar 22-Dec-11 10:09am    
No it is not possible...I have alrady done....tht..
Well you are not going to be able to add nine different images to a PictureBox control. You can only show one image! As an alternative you could use nine seperate picture boxes all positioned together. i.e.

C#
Point posOnForm = new Point(20, 20);
int picBoxWidth = 32;
int picBoxHeight = 32;

PictureBox[,] picBoxes = new PictureBox[3, 3];
for (int i = 0; i < picBoxes.GetLength(0); i++)
{
    for (int n = 0; n < picBoxes.GetLength(1); n++)
    {
        picBoxes[i, n] = new PictureBox();

        picBoxes[i, n].Parent = this;

        picBoxes[i, n].Size = new System.Drawing.Size(picBoxWidth, picBoxHeight);

        picBoxes[i, n].Location = new Point(
            posOnForm.X + (n * picBoxWidth),
            posOnForm.Y + (i * picBoxHeight));

        //picBoxes[i, n].Image = someImg;
        // OR
        picBoxes[i, n].ImageLocation = "myimg.png";
    }
}


And for zooming Google is your friend
how to zoom image c#[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900