我不知道如何多次用小载图像填充图片框然后保存它。 Picturebox的大小由用户决定。然后我加载图像并使用当前大小的图片框将其尽可能多地放到图片框中。 知道怎么做吗? 下面的示例显示它应该是什么样子(但这里有一个背景,我不能在一张图片中保存这些多个图像)
PS。我不能放置图像,因为我没有足够的声誉:(
答案 0 :(得分:1)
您使用BackgroundImage
将图片添加为BackgroundImageLayout = ImageLayout.Tile
,然后使用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);
}
要获得完全控制权,您可以使用DrawImage
将多个图片绘制到图片的Bitmap
,但对于您的问题,上面应该这样做..