private void openModelesslyToolStripMenuItem_Click(object sender, EventArgs e) { PreferencesDialogue prefdlg = new PreferencesDialogue(); prefdlg.Apply += new EventHandler(infoGrab_Apply); prefdlg.closing += new EventHandler(revert_Info); prefdlg.Show(this); }
private void revert_Info(object sender, EventArgs e) //Reverting info to default values { PreferencesDialogue prefdlg = sender as PreferencesDialogue; this.eWidth = this.defaultEllipseWidth; this.eRatio = this.defaultEllipseRatio; this.recHeight = this.defaultRectangleHeight; this.recRatio = this.defaultRectangleRatio; }
void infoGrab_Apply(object sender, EventArgs e) //Grabbing All info inputted in the Preferences Dialog { PreferencesDialogue prefdlg = sender as PreferencesDialogue; this.eWidth = prefdlg.ElipseWidth; this.eRatio = prefdlg.ElipseRatio; this.recHeight = prefdlg.RectangularHeight; this.recRatio = prefdlg.RectangleRatio; //Change for getting the values of the Custom Child }
private void openModallyToolStripMenuItem_Click(object sender, EventArgs e) { using (PreferencesDialogue prefdlg = new PreferencesDialogue()) { prefdlg.ShowDialog(); this.eWidth = prefdlg.ElipseWidth; this.eRatio = prefdlg.ElipseRatio; this.recHeight = prefdlg.RectangularHeight; this.recRatio = prefdlg.RectangleRatio; } }
private void openModelesslyToolStripMenuItem_Click(object sender, EventArgs e) { if (modelessDlg == null || modelessDlg.IsDisposed) { modelessDlg = createPrefDialogue(); //Change this when you have the Preferences Dialog working, this is just a test to see if it works. this.Update(); //Check if this is the correct code for updating the properties of the Form. modelessDlg.Show(this); } else { modelessDlg.Activate(); } }
PreferencesDialogue createPrefDialogue() { //creates pref dialogue and initializes it with current (or default values) PreferencesDialogue prefdlg = new PreferencesDialogue(); prefdlg.ElipseWidth = this.eWidth; prefdlg.ElipseRatio = this.eRatio; prefdlg.RectangularHeight = this.recHeight; prefdlg.RectangleRatio = this.recRatio; prefdlg.Apply += infoGrab_Apply; prefdlg.GotFocus += Prefdlg_GotFocus; prefdlg.Activated += Prefdlg_Activated; return(prefdlg); }