Exemple #1
0
        private void editPictureButton_Click(object sender, EventArgs e)
        {
            ImageProcessing ip = new ImageProcessing(selectedPicture);

            ip.ShowDialog();
            selectedPicture = ip.returnCurrentEditingPicture();
            bool isSame = ip.returnIsSame();


            if (isSame)
            {
                selectedPicture.PictureBitmap.Save(selectedPicture.Path);
            }
            else
            {
                string format = ip.returnPictureFormat();
                string str    = selectedPicture.Path.Remove(selectedPicture.Path.Length - 4);

                string newPath = str + "." + format;
                selectedPicture.Path = newPath;
                //MessageBox.Show(newPath);
                if (System.IO.File.Exists(selectedPicture.Path))
                {
                    System.IO.File.Delete(selectedPicture.Path);
                }

                if (format.Equals("png"))
                {
                    selectedPicture.PictureBitmap.Save(selectedPicture.Path, System.Drawing.Imaging.ImageFormat.Png);
                }
                else if (format.Equals("gif"))
                {
                    selectedPicture.PictureBitmap.Save(selectedPicture.Path, System.Drawing.Imaging.ImageFormat.Gif);
                }
                else if (format.Equals("jpg"))
                {
                    selectedPicture.PictureBitmap.Save(selectedPicture.Path, System.Drawing.Imaging.ImageFormat.Jpeg);
                }
            }



            treeView1.Nodes.Clear();
            PopulateTree(rootAlbum, null);
            treeView1.ExpandAll();

            setCurrentBitmapList();
        }
Exemple #2
0
        private void editPictureButton_Click(object sender, EventArgs e)
        {
            ImageProcessing ip = new ImageProcessing(selectedPicture);
            ip.ShowDialog();
            selectedPicture = ip.returnCurrentEditingPicture();
            bool isSame = ip.returnIsSame();

            if (isSame)
            {
                selectedPicture.PictureBitmap.Save(selectedPicture.Path);
            }
            else
            {
                string format = ip.returnPictureFormat();
                string str = selectedPicture.Path.Remove(selectedPicture.Path.Length - 4);

                string newPath = str + "." + format;
                selectedPicture.Path = newPath;
                //MessageBox.Show(newPath);
                if (System.IO.File.Exists(selectedPicture.Path))
                    System.IO.File.Delete(selectedPicture.Path);

                if (format.Equals("png"))
                {
                    selectedPicture.PictureBitmap.Save(selectedPicture.Path, System.Drawing.Imaging.ImageFormat.Png);
                }
                else if (format.Equals("gif"))
                {
                    selectedPicture.PictureBitmap.Save(selectedPicture.Path, System.Drawing.Imaging.ImageFormat.Gif);
                }
                else if (format.Equals("jpg"))
                {
                    selectedPicture.PictureBitmap.Save(selectedPicture.Path, System.Drawing.Imaging.ImageFormat.Jpeg);
                }
            }

            treeView1.Nodes.Clear();
            PopulateTree(rootAlbum, null);
            treeView1.ExpandAll();

            setCurrentBitmapList();
        }