コード例 #1
0
 /// <summary>
 /// Добавление фото.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnAdd_Click(object sender, EventArgs e)
 {
     if (OpenImage.ShowDialog() == DialogResult.OK)
     {
         phonoPictureBox.Load(OpenImage.FileName);
     }
 }
コード例 #2
0
 private void LoadImage_Click(object sender, EventArgs e)
 {
     if (OpenImage.ShowDialog() == DialogResult.OK)
     {
         LoadedImage       = true;
         ImagePath         = OpenImage.FileName;
         pictureBox1.Image = Rescale(new Bitmap(ImagePath), 128, 128);
     }
 }
コード例 #3
0
        private void loadNewImageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (OpenImage.ShowDialog() == DialogResult.OK)
            {
                SelectedImage    = new Bitmap(OpenImage.FileName);
                FinalImage       = new Bitmap(OpenImage.FileName);
                picPreview.Image = SelectedImage;

                menuReload.Enabled = true;
            }
        }
コード例 #4
0
        private void AddImageButton_Click(object sender, EventArgs e)
        {
            DialogResult result = OpenImage.ShowDialog();

            if (result == DialogResult.OK)
            {
                OpenPath                   = OpenImage.FileName;
                OpenFileName               = OpenImage.SafeFileName;
                SavePath                   = @"data\book\pic\" + OpenImage.SafeFileName;
                NewImageBox.Image          = Image.FromFile(OpenPath);
                OpenImage.InitialDirectory = OpenPath.Substring(0, OpenPath.Length - OpenImage.SafeFileName.Length);
            }
        }
コード例 #5
0
 private void OpenMI_Click(object sender, EventArgs e)
 {
     if (OpenImage.ShowDialog() == DialogResult.OK)
     {
         bool success = true;
         foreach (string path in OpenImage.FileNames)
         {
             try
             {
                 Bitmap image;
                 using (FileStream stream = new FileStream(path, FileMode.Open))
                     image = new Bitmap(stream);
                 if (!image.RawFormat.Equals(ImageFormat.Bmp) && !image.RawFormat.Equals(ImageFormat.Jpeg))
                 {
                     Message.Warning("Incorrect image format!", Text);
                 }
                 else
                 {
                     images.Add(counter, new BitmapPair(image));
                     //picture
                     PictureBox picture = new PictureBox();
                     picture.Name             = "PB" + counter;
                     picture.SizeMode         = PictureBoxSizeMode.Zoom;
                     picture.Dock             = DockStyle.Fill;
                     picture.Image            = image;
                     picture.ContextMenuStrip = ImageMenu;
                     //tabpage for picture
                     TabPage page = new TabPage(Path.GetFileName(path));
                     page.Name = "TP" + counter;
                     page.Controls.Add(picture);
                     Tabs.TabPages.Add(page);
                     ++counter;
                 }
             }
             catch (Exception exception)
             {
                 Log.Append(exception.Message + Environment.NewLine + exception.StackTrace);
                 success = false;
             }
         }
         if (!success)
         {
             Message.Warning("Failed to open some images!", Text);
         }
         UpdateUI();
     }
 }
コード例 #6
0
        private void AddImageButton_Click(object sender, EventArgs e)
        {
            DialogResult result = OpenImage.ShowDialog();

            if (result == DialogResult.OK)
            {
                string path = OpenImage.FileName;
                if (!File.Exists(@"data\book\pic\" + OpenImage.SafeFileName))
                {
                    System.IO.File.Copy(path, @"data\book\pic\" + OpenImage.SafeFileName, true);
                }
                else
                {
                    tmp = 1;
                }
                SavePath = @"data\book\pic\" + OpenImage.SafeFileName;
                BookImagePictureBox.Image  = Image.FromFile(path);
                OpenImage.InitialDirectory = path.Substring(0, path.Length - OpenImage.SafeFileName.Length);
            }
        }