-1

I don't know how to fill picturebox with small loaded image multiple times and then save it. Picturebox has a size determined by user. Then I load the image and put it to picturebox as many times as possible with current size of picturebox. Any idea how to do that? Example bellow shows how it should look like (but here there is a background and i cant save this multiple images in one picture)

enter image description here

PS. I can't place image because i don't have enough reputation:(

TaW
  • 53,122
  • 8
  • 69
  • 111
Skylin R
  • 2,111
  • 1
  • 20
  • 23
  • Your question is too broad. What _specifically_ are you having trouble with? What have you tried? Please provide [a good, _minimal_, _complete_ code example](http://stackoverflow.com/help/mcve) that shows clearly what you've tried, along with a precise explanation of what that code does and how that's different from what you want. You can use `DrawToBitmap()` to have a control draw its contents to a bitmap, and of course you can use the `Bitmap.Save()` method to save the bitmap. What _specifically_ is it you're having trouble figuring out? – Peter Duniho Nov 22 '15 at 00:11

1 Answers1

1

You add the image as the BackgroundImage with BackgroundImageLayout = ImageLayout.Tile and then save the result with DrawToBitmap.

pictureBox1.BackgroundImage = someImage;
pictureBox1.BackgroundImageLayout = ImageLayout.Tile;

using (Bitmap bmp = new Bitmap(pictureBox1.ClientSize.Width, 
                               pictureBox1.ClientSize.Height))
{
    pictureBox1.DrawToBitmap(bmp, pictureBox1.ClientRectangle);
    bmp.Save(yourSaveFileName, System.Drawing.Imaging.ImageFormat.Png);
}

For full control you would use DrawImage to draw multiple images into the Bitmap of the Image, but for your question the above should do..

TaW
  • 53,122
  • 8
  • 69
  • 111