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 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(); } }
/// <summary> /// Initializes a new instance of the <see cref="RichTextEditor"/> class. /// </summary> public RichTextEditor() { InitializeComponent(); if (DesignMode) { return; } SaveAsToolStripMenuItem.BindCommand(rtbDoc.SaveAsCommand); SaveToolStripMenuItem.BindCommand(rtbDoc.SaveCommand); OpenToolStripMenuItem.BindCommand(rtbDoc.OpenFileCommand); NewToolStripMenuItem.BindCommand(rtbDoc.NewFileCommand); InsertImageToolStripMenuItem.BindCommand(rtbDoc.InsertImageCommand); tbrSave.BindCommand(rtbDoc.SaveCommand); tbrOpen.BindCommand(rtbDoc.OpenFileCommand); tbrNew.BindCommand(rtbDoc.NewFileCommand); rtbDoc.CurrentFileNameChanged += rtbDoc_CurrentFileNameChanged; }
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 = ""; }