I use flowLayoutPanel as a collection of images that come from a list of images which can be clicked and afterwards displayed in bigger pictureBoxes. I wonder if there is any possibility to make a margin in that panel so for example if I want to save those images into one PDF file, I can choose to split a list of images into two lists. I thought about drag and drop or choose method but this one is much easier to use. Here is the code of displaying images from a list into smaller pictureBoxes in flowLayoutPanel :
foreach (Image image in images)
{
PictureBox pf = new PictureBox();
pf.SizeMode = PictureBoxSizeMode.StretchImage;
pf.Height = 150;
pf.Width = 170;
pf.Image = image;
pf.Click += new EventHandler(pictureClicked);
flowLayoutPanel2.Controls.Add(pf);
}
And a click method :
public PictureBox clickedPicture;
void pictureClicked(object sender, EventArgs e)
{
if (clickedPicture != null)
clickedPicture.BorderStyle = BorderStyle.None;
clickedPicture = (PictureBox)sender;
clickedPicture.BorderStyle = BorderStyle.FixedSingle;
pictureBoxFront.Image = clickedPicture.Image;
}
Try this code
Source: http://msdn.microsoft.com/en-us/library/ms159414.aspx
Public Structure Padding Padding: http://msdn.microsoft.com/en-us/library/system.windows.forms.padding.aspx