Skip to content

Instantly share code, notes, and snippets.

@rarous
Created August 29, 2013 10:56
Show Gist options
  • Save rarous/6376694 to your computer and use it in GitHub Desktop.
Save rarous/6376694 to your computer and use it in GitHub Desktop.
bool nacteno = false;
private void metNactiFotky()
{
flowLayoutPanel1.Controls.Clear();
cesta = "D:\\PedikuraFotky\\00_Nafocene"; // v této složce mám řekněme 20 fotek
bool adrExist = Directory.Exists(cesta);
if (adrExist)
{
if (cesta != "")
{
string[] soubory = Directory.GetFiles(cesta);
if (soubory.Length > 0 )
{
List<PictureBox> pictureBoxList = new List<PictureBox>();
for (int i = 0; i < soubory.Length; i++)
{
PictureBox picture = new PictureBox
{
Name = soubory[i],
Size = new Size(160, 120),
Location = new Point(i * 160, 1),
BorderStyle = BorderStyle.FixedSingle,
SizeMode = PictureBoxSizeMode.Zoom
};
picture.Click += this.PictureClick;
FileStream obrazek_FS = new FileStream(soubory[i], FileMode.Open, FileAccess.Read);
picture.Image = Image.FromStream(obrazek_FS);
pictureBoxList.Add(picture);
obrazek_FS.Close();
}
foreach (PictureBox p in pictureBoxList)
{
flowLayoutPanel1.Controls.Add(p);
}
nacteno = true;
}
}
else
{
nacteno = false;
}
}
else
{
Directory.CreateDirectory(cesta);
Poruchy.metOznam("Adresář D:\\PedikuraFotky\\00_Nafocene byl vytvořen, neobsahuje však žádné fotky k zatřídění ");
nacteno = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment