public static ContextMenuStrip Create() { // Add the default menu options. ContextMenuStrip menu = new ContextMenuStrip(); ToolStripMenuItem item; ToolStripSeparator sep; // Windows Explorer. item = new ToolStripMenuItem(); item.Text = "Settings"; item.Click += ( o, e ) => { if ( !isSettingsOpen ) { isSettingsOpen = true; Forms.SettingsForm settingsForm = new Forms.SettingsForm(); settingsForm.FormClosing += ( fo, fe ) => { isSettingsOpen = false; }; settingsForm.Show(); } }; // item.Image = Resources.Explorer; menu.Items.Add( item ); // Separator. sep = new ToolStripSeparator(); menu.Items.Add( sep ); // Exit. item = new ToolStripMenuItem(); item.Text = "Exit"; item.Click += new System.EventHandler( Exit_Click ); // item.Image = Resources.Exit; menu.Items.Add( item ); return menu; }
/// <summary> /// 設定ボタン /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SettingButton_Click(object sender, EventArgs e) { var form = new Forms.SettingsForm(this.SettingsParameters); form.ShowDialog(); }
public void ShowSettings() { try { using (var settgingsForm = new Forms.SettingsForm(_settings)) { if (settgingsForm.ShowDialog() == DialogResult.OK) { InitDrawImage(); BlockAlignButton(); } } } catch (Exception ex) { Logging.Logger.Log(Logging.SeverityGrades.Warning, string.Format("Error while applying new settings: {0}", ex.Message)); } }