HOW TO SPLIT A SINGLE PICTUREBOX INTO THREE PARTITIONS

Madhu Mitha

Total Post:31

Points:217
Posted by  Madhu Mitha
VB.Net 
 757  View(s)
Ratings:
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

  1. Ankit Singh

    Post:341

    Points:2389
    Re: how to split a single picturebox into three partitions

    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];

  1. Madhu Mitha

    Post:31

    Points:217
    Re: how to split a single picturebox into three partitions

    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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!