Ejemplo n.º 1
0
        public void RefreshImages()
        {
            imagepaths.Clear();
            nametopath.Clear();
            Bilder_Anzeige.Controls.Clear();
            try
            {
                imagepaths = ImageUtils.getImagesinFolder(Variablen.path);
                String firstpath = "";

                foreach (String path in imagepaths)
                {
                    if (!nametopath.ContainsKey(ImageUtils.getImageName(path)))
                    {
                        if (Image.FromFile(path).Width >= Image.FromFile(path).Height)
                        {
                            //imagepaths.Remove(path);
                        }
                        else
                        {
                            if (firstpath == "")
                            {
                                firstpath = path;
                            }
                            nametopath.Add(ImageUtils.getImageName(path), path);
                            PictureBox image = new PictureBox();
                            image.Width    = 125;
                            image.Height   = 175;
                            image.SizeMode = PictureBoxSizeMode.StretchImage;
                            image.Name     = ImageUtils.getImageName(path);
                            image.Visible  = true;
                            image.Image    = Image.FromFile(path);
                            image.Click   += Image_Click;

                            Bilder_Anzeige.Controls.Add(image);
                        }
                    }
                }


                UpdatePreviewImage(firstpath);
                LabelNoPics.Hide();
            }
            catch
            {
                Bilder_Anzeige.Controls.Add(LabelNoPics);
                LabelNoPics.Show();
            }
            CheckPics();
        }
Ejemplo n.º 2
0
        private void CheckPics()
        {
            int Count = 0;

            foreach (Control c in Bilder_Anzeige.Controls)
            {
                if (c is PictureBox)
                {
                    Count++;
                }
            }
            if (Count > 0)
            {
                LabelNoPics.Hide();
            }
            else
            {
                Bilder_Anzeige.Controls.Add(LabelNoPics);
                LabelNoPics.Show();
            }
        }