private void paintFavourites()
        {
            int y = 122;

            for (int i = 0; i < Favourites.Count; i++)
            {
                PictureBox k = new PictureBox();
                k.Name     = "pictureBox" + (i + 2).ToString();
                k.Location = new Point(104, y);
                k.Size     = new Size(99, 125);
                k.Image    = FormChoosingFavourite.resizeImage(Favourites[i].Img, new Size(k.Size.Width, k.Size.Height));
                this.Controls.Add(k);

                Label l = new Label();
                l.Name      = "label" + (i + 2).ToString();
                l.Location  = new Point(250, y);
                l.Font      = label1.Font;// new Font(FontFamily.GenericSansSerif, 20, FontStyle.Regular);
                l.ForeColor = SystemColors.ButtonHighlight;
                l.AutoSize  = true;
                l.Text      = (i + 1).ToString() + ") " + Favourites[i].Name;
                this.Controls.Add(l);
                y += 150;
            }
            Label la = new Label();

            la.Name     = "label" + (Favourites.Count + 1).ToString();
            la.Text     = "";
            la.Location = new Point(1, y += 70);
            this.Controls.Add(la);
        }
Esempio n. 2
0
 private void buttonNext_Click(object sender, EventArgs e)
 {
     try
     {
         DirectoryInfo folder = new DirectoryInfo(path);
         if (checkedListBoxType.CheckedItems.Count == 0)
         {
             throw new Exception();
         }
         f1 = new FormChoosingFavourite(path, type);
         f1.Show();
         this.Hide();
     }
     catch (ArgumentException)
     {
         errorProvider1.SetError(textBox1, "The Path is Incorrect");
     }
     catch (PathTooLongException)
     {
         errorProvider1.SetError(textBox1, "The Path is Incorrect");
     }
     catch (Exception)
     {
         if (checkedListBoxType.CheckedItems.Count == 0)
         {
             errorProvider1.SetError(checkedListBoxType, "Check One Of This List");
         }
     }
 }