fixed close button on Find/Replace window and fixed crash after closing the Find/Replace window with the X button

This commit is contained in:
codeimp 2008-09-01 12:41:45 +00:00
parent c39750eb15
commit 6b8f631bf8
2 changed files with 19 additions and 0 deletions

View file

@ -166,6 +166,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.closebutton.TabIndex = 8; this.closebutton.TabIndex = 8;
this.closebutton.Text = "Close"; this.closebutton.Text = "Close";
this.closebutton.UseVisualStyleBackColor = true; this.closebutton.UseVisualStyleBackColor = true;
this.closebutton.Click += new System.EventHandler(this.closebutton_Click);
// //
// resultslist // resultslist
// //
@ -253,6 +254,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Find and Replace"; this.Text = "Find and Replace";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FindReplaceForm_FormClosing);
this.resultspanel.ResumeLayout(false); this.resultspanel.ResumeLayout(false);
this.resultspanel.PerformLayout(); this.resultspanel.PerformLayout();
this.groupreplace.ResumeLayout(false); this.groupreplace.ResumeLayout(false);

View file

@ -206,6 +206,23 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
// Window closing
private void FindReplaceForm_FormClosing(object sender, FormClosingEventArgs e)
{
// If the user closes the form, then just cancel the mode
if(e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
General.Map.CancelMode();
}
}
// Close button clicked
private void closebutton_Click(object sender, EventArgs e)
{
General.Map.CancelMode();
}
#endregion #endregion
#region ================== Methods #region ================== Methods