Ejemplo n.º 1
0
        private DialogResult OpenFile()
        {
            if (DLG_Open.ShowDialog() == DialogResult.OK)
            {
                bool Open;
                if (FileChanged)
                {
                    DialogResult result = PromptSave();
                    if (result == DialogResult.Yes)
                    {
                        result = SaveFileAs();
                        Open   = (result == DialogResult.OK);
                    }
                    else
                    {
                        Open = (result != DialogResult.Cancel);
                    }
                }
                else
                {
                    Open = true;
                }

                if (Open)
                {
                    LoadImage(new Bitmap(DLG_Open.FileName));
                }
                return(DialogResult.OK);
            }
            return(DialogResult.Cancel);
        }
Ejemplo n.º 2
0
 private void BTN_Open_Click(object sender, EventArgs e)
 {
     if (DLG_Open.ShowDialog() == DialogResult.OK)
     {
         string Path        = DLG_Open.FileName;
         Bitmap ImageOpened = new Bitmap(Path);
         this.Visible = false;
         FRM_Main main = new FRM_Main(ImageOpened);
         main.ShowDialog();
         this.Close();
     }
 }