Beispiel #1
0
        private void ribbonButton4_Click(object sender, EventArgs e)
        {
            // Save
            MainForm mainForm = (MainForm)this.parent;
            Cursor oldCursor = mainForm.Cursor;
            try
            {
                mainForm.Cursor = ApplicationWaitCursor.Cursor;

                this.Hide();
                Application.DoEvents();

                if (Program.Destination != null && Program.Destination.Image != null)
                {
                    MainForm frmMain = ((MainForm)this.parent);

                    if (Effects2.BoxFilter.Angle > 0)
                    {
                        frmSelectBackGround frmSelectBG = new frmSelectBackGround(mainForm);
                        DialogResult res = frmSelectBG.ShowDialog();

                        if (res == DialogResult.Cancel)
                        {
                            Extra.Enable = false;
                            Extra.BackgroundColor = Color.Empty;
                            return;
                        }
                    }

                    Bitmap photo = frmMain.FilterEffectsForSave();
                    //Program.Destination.Image.Save(Program.FileName, Program.Source.Image.RawFormat);
                    ImageFormat format = Program.Photo.RawFormat;

                    //Create a backup if one already doesn't exist
                    this.Backup(Program.FileName);

                    photo.Save(Program.FileName, format);


                    mainForm.imageViewer1.UpdateThumbnail(Program.FileName);

                    Image old = Program.Source.Image;

                    Program.Source.Image = (Image)Program.Destination.Image.Clone();
                    Program.Source.Refresh();

                    OpenFile(Program.FileName);

                    Extra.Enable = false;
                    Extra.BackgroundColor = Color.Empty;

                    this.Close();
                }
            }
            catch { }
            finally
            {
                mainForm.Cursor = oldCursor;
                Extra.Enable = false;
                Extra.BackgroundColor = Color.Empty;
            }
            
        }
Beispiel #2
0
        private void ribbonButton4_Click(object sender, EventArgs e)
        {
            // Save
            MainForm mainForm  = (MainForm)this.parent;
            Cursor   oldCursor = mainForm.Cursor;

            try
            {
                mainForm.Cursor = ApplicationWaitCursor.Cursor;

                this.Hide();
                Application.DoEvents();

                if (Program.Destination != null && Program.Destination.Image != null)
                {
                    MainForm frmMain = ((MainForm)this.parent);

                    if (Effects2.BoxFilter.Angle > 0)
                    {
                        frmSelectBackGround frmSelectBG = new frmSelectBackGround(mainForm);
                        DialogResult        res         = frmSelectBG.ShowDialog();

                        if (res == DialogResult.Cancel)
                        {
                            Extra.Enable          = false;
                            Extra.BackgroundColor = Color.Empty;
                            return;
                        }
                    }

                    Bitmap photo = frmMain.FilterEffectsForSave();
                    //Program.Destination.Image.Save(Program.FileName, Program.Source.Image.RawFormat);
                    ImageFormat format = Program.Photo.RawFormat;

                    //Create a backup if one already doesn't exist
                    this.Backup(Program.FileName);

                    photo.Save(Program.FileName, format);


                    mainForm.imageViewer1.UpdateThumbnail(Program.FileName);

                    Image old = Program.Source.Image;

                    Program.Source.Image = (Image)Program.Destination.Image.Clone();
                    Program.Source.Refresh();

                    OpenFile(Program.FileName);

                    Extra.Enable          = false;
                    Extra.BackgroundColor = Color.Empty;

                    this.Close();
                }
            }
            catch { }
            finally
            {
                mainForm.Cursor       = oldCursor;
                Extra.Enable          = false;
                Extra.BackgroundColor = Color.Empty;
            }
        }