Home > DeveloperSection > Forums > how to split a single picturebox into three partitions
Madhu Mitha
Madhu Mitha

Total Post:31

Points:217
Posted on    March-23-2015 3:53 AM

 .NET VB.Net 
Ratings:


 2 Reply(s)
 443  View(s)
Rate this:
hi,,

     I want to split a single picturebox into three partitions so that i can save my image in in three locations with different sizes.. is there anyone know how to do.. plz help me doing this

thank you



Ankit Singh

Total Post:341

Points:2389
Posted on    March-23-2015 4:40 AM

You can use an array with a size of 3. Then it's much easier to do this using a couple of loops like this:

var imgarray = new Image[3];

            var img = Image.FromFile("media\\a.png");

            for (int i = 0; i < 3; i++)

            {

                for (int j = 0; j < 3; j++)

                {

                    var index = i * 3 + j;

                    imgarray[index] = new Bitmap(104, 104);

                    var graphics = Graphics.FromImage(imgarray[index]);

                    graphics.DrawImage(img, new Rectangle(0, 0, 104, 104), new Rectangle(i * 104, j * 104, 104, 104), GraphicsUnit.Pixel);

                    graphics.Dispose();

                }

            }

 

Then you can fill your boxes like this:

pictureBox1.Image = imgarray[0];

pictureBox2.Image = imgarray[1];


Madhu Mitha
Madhu Mitha

Total Post:31

Points:217
Posted on    March-23-2015 5:02 AM

hi Ankit,,


              It is possible by using same method can i draw strings.. i get input from three textboxes and i want to place the strings in different location


thank u

Don't want to miss updates? Please click the below button!

Follow MindStick