private void ExitToolStripMenuItem_Click(object sender, EventArgs e) { if (FirstDraw) { DialogResult result = MessageBox.Show("Ar norite issaugoti darba?", "Issaugoti?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result == DialogResult.Cancel) { return; } if (result == DialogResult.No) { //this.Close(); Application.Exit(); } if (result == DialogResult.Yes) { SaveToolStripMenuItem.PerformClick(); Application.Exit(); } this.Close(); } }
private void NewToolStripMenuItem_Click(object sender, EventArgs e) { if (FirstDraw) { DialogResult result = MessageBox.Show("Ar norite issaugoti darba?", "Issaugoti?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result == DialogResult.Cancel) { return; } if (result == DialogResult.No) { SavedFilePath = ""; FirstDraw = false; this.Text = "Untitled"; Gr.Clear(Color.White); DisplayImage(); } if (result == DialogResult.Yes) { SaveToolStripMenuItem.PerformClick(); SavedFilePath = ""; FirstDraw = false; this.Text = "Untitled"; Gr.Clear(Color.White); DisplayImage(); } } }
private void openImageToolStripMenuItem_Click(object sender, EventArgs e) { if (FirstDraw) { SaveToolStripMenuItem.PerformClick(); } var ofd = new OpenFileDialog(); ofd.Filter = "JPG file|*.jpg|PNG file|*.png|BMP file|*.bmp"; ofd.Title = "SelectImage"; ofd.CheckFileExists = false; ofd.CheckPathExists = false; if (ofd.ShowDialog() == DialogResult.OK) { Picture = new Bitmap(ofd.FileName); // SavedFilePath = ofd.FileName; DisplayImage(); //this.Text = ofd.FileName; } SavedFilePath = ""; }