Esempio n. 1
0
 private void OpenButton_Click(object sender, EventArgs e)
 {
     OpenDialog.InitialDirectory = LastOpenPath;
     OpenDialog.FileName         = "";
     if (OpenDialog.ShowDialog() == DialogResult.OK)
     {
         LastOpenPath        = OpenDialog.FileName;
         ImportBar.Visible   = true;
         ImportLabel.Visible = true;
         List <BetterPicBox> newboxes = new List <BetterPicBox>();
         foreach (string path in OpenDialog.FileNames)
         {
             BetterPicBox pic = new BetterPicBox(null, ResizeImg(Image.FromFile(path), 128, 128, InterpolationCombo.SelectedIndex == 0 ? InterpolationMode.NearestNeighbor : InterpolationMode.HighQualityBicubic))
             {
                 Width       = 128,
                 Height      = 128,
                 SizeMode    = PictureBoxSizeMode.Zoom,
                 BorderStyle = BorderStyle.FixedSingle
             };
             Pictures.Add(pic);
             newboxes.Add(pic);
             pic.MouseClick += Pic_MouseClick;
         }
         OpenButton.Enabled = false;
         // mapify the new images in the background
         ImportProcessor.RunWorkerAsync(newboxes);
     }
 }
Esempio n. 2
0
        private void Pic_MouseClick(object sender, MouseEventArgs e)
        {
            BetterPicBox b = sender as BetterPicBox;

            if (e.Button == MouseButtons.Right)
            {
                Pictures.Remove(b);
                PictureZone.Controls.Remove(b);
                PictureZone_Resize(null, null);
                ExportButton.Enabled = Pictures.Count > 0;
            }
        }