/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { try { if (disposing) { // Release the added managed resources btnBrowse.Dispose(); lblResults.Dispose(); txtResults.Dispose(); lblSearchText.Dispose(); txtSearchText.Dispose(); lblFiles.Dispose(); txtFiles.Dispose(); btnSearch.Dispose(); ckRecursive.Dispose(); lblDir.Dispose(); txtDir.Dispose(); lblCurFile.Dispose(); txtCurFile.Dispose(); } } finally { // Call Dispose on your base class. base.Dispose(disposing); } }
public static DialogResult MessageShowAgain(string title, string promptText) { Form form = new Form(); System.Windows.Forms.Label label = new System.Windows.Forms.Label(); CheckBox chk = new CheckBox(); Controls.MyButton buttonOk = new Controls.MyButton(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainV2)); form.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); form.Text = title; label.Text = promptText; chk.Tag = ("SHOWAGAIN_" + title.Replace(" ", "_")); chk.AutoSize = true; chk.Text = "Show me again?"; chk.Checked = true; chk.Location = new Point(9, 80); if (MainV2.config[(string)chk.Tag] != null && (string)MainV2.config[(string)chk.Tag] == "False") // skip it { form.Dispose(); chk.Dispose(); buttonOk.Dispose(); label.Dispose(); return DialogResult.OK; } chk.CheckStateChanged += new EventHandler(chk_CheckStateChanged); buttonOk.Text = "OK"; buttonOk.DialogResult = DialogResult.OK; buttonOk.Location = new Point(form.Right - 100, 80); label.SetBounds(9, 40, 372, 13); label.AutoSize = true; form.ClientSize = new Size(396, 107); form.Controls.AddRange(new Control[] { label, chk, buttonOk }); form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.StartPosition = FormStartPosition.CenterScreen; form.MinimizeBox = false; form.MaximizeBox = false; ThemeManager.ApplyThemeTo(form); DialogResult dialogResult = form.ShowDialog(); form.Dispose(); form = null; return dialogResult; }