public static DialogResultExt Show(IWin32Window owner, string text = "", string caption = "", MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.None, MsgBoxExtDefaultButton defButton = MsgBoxExtDefaultButton.Unknown, bool showCheckBox = false, string checkBoxText = "", Font messageFont = null, Color?messageForeColor = null, Color?messageBackColor = null) { // Setup return value and defaults each time as it's static - Cancel is default incase user x's the form result = new DialogResultExt { Result = System.Windows.Forms.DialogResult.Cancel, CheckBoxState = false }; var msgBoxExtForm = new MsgBoxExtForm(); msgBoxExtForm.ShowInTaskbar = false; msgBoxExtForm.ShowIcon = false; // Set window size defaults msgBoxExtForm.SetWindowDefaults(); // Set window title msgBoxExtForm.Text = caption; if (messageBackColor != null) { msgBoxExtForm.pnlMain.BackColor = (Color)messageBackColor; msgBoxExtForm.pnlIcon.BackColor = (Color)messageBackColor; msgBoxExtForm.textBox.BackColor = (Color)messageBackColor; } // Set the message text and styles msgBoxExtForm.textBox.Font = (messageFont == null) ? SystemFonts.DialogFont : messageFont; msgBoxExtForm.textBox.ForeColor = (!messageForeColor.HasValue) ? SystemColors.WindowText : messageForeColor.Value; msgBoxExtForm.textBox.Text = text.Replace("\n", "\r\n"); // Set text last as it depends on the font size etc // Toggle Display again checkbox msgBoxExtForm.checkBox.Visible = showCheckBox; msgBoxExtForm.checkBox.Text = checkBoxText; // Set Icons [32x32] msgBoxExtForm.SetIcons(icon); defButtonIndex = (int)defButton; // Set buttons and adjust form width based on button count msgBoxExtForm.SetButtons(buttons); return(new DialogResultExt { Result = msgBoxExtForm.ShowDialog(owner), CheckBoxState = msgBoxExtForm.checkBox.Checked }); }
/// <summary> /// Shows the extended message box. /// </summary> /// <param name="owner">The owner.</param> /// <param name="text">The text.</param> /// <param name="caption">The caption.</param> /// <param name="buttons">The buttons.</param> /// <param name="icon">The icon.</param> /// <returns>The dialog result.</returns> public static DialogResultExt Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) { return(MsgBoxExtForm.Show(owner, text, caption, buttons, icon)); }
/// <summary> /// Shows the extended message box. /// </summary> /// <param name="text">The text.</param> /// <param name="caption">The caption.</param> /// <param name="buttons">The buttons.</param> /// <returns>The dialog result.</returns> public static DialogResultExt Show(string text, string caption, MessageBoxButtons buttons) { return(MsgBoxExtForm.Show(null, text, caption, buttons)); }
/// <summary> /// Shows the extended message box. /// </summary> /// <param name="text">The text.</param> /// <param name="caption">The caption.</param> /// <returns>The dialog result.</returns> public static DialogResultExt Show(string text, string caption) { return(MsgBoxExtForm.Show(null, text, caption)); }
/// <summary> /// Shows the extended message box. /// </summary> /// <param name="owner">The owner.</param> /// <param name="text">The text.</param> /// <param name="caption">The caption.</param> /// <returns>The dialog result.</returns> public static DialogResultExt Show(IWin32Window owner, string text, string caption) { return(MsgBoxExtForm.Show(owner, text, caption)); }
/// <summary> /// Shows the extended message box. /// </summary> /// <param name="owner">The owner.</param> /// <param name="text">The text.</param> /// <returns>The dialog result.</returns> public static DialogResultExt Show(IWin32Window owner, string text) { return(MsgBoxExtForm.Show(null, text)); }
/// <summary> /// Shows the extended message box. /// </summary> /// <param name="text">The text.</param> /// <param name="caption">The caption.</param> /// <param name="buttons">The buttons.</param> /// <param name="icon">The icon.</param> /// <param name="defaultButton">The default button.</param> /// <param name="showCheckBox">The show check box flag.</param> /// <param name="checkBoxText">The check box text.</param> /// <param name="messageFont">The message font.</param> /// <param name="messageForeColor">The message font color.</param> /// <param name="messageBackColor">The message back color.</param> /// <returns>The dialog result.</returns> public static DialogResultExt Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MsgBoxExtDefaultButton defButton, bool showCheckBox = false, string checkBoxText = "", Font messageFont = null, Color?messageForeColor = null, Color?messageBackColor = null) { return(MsgBoxExtForm.Show(null, text, caption, buttons, icon, defButton, showCheckBox, checkBoxText, messageFont, messageForeColor, messageBackColor)); }
/// <summary> /// Shows the extended message box. /// </summary> /// <param name="owner">The owner.</param> /// <param name="text">The text.</param> /// <param name="caption">The caption.</param> /// <param name="buttons">The buttons.</param> /// <param name="icon">The icon.</param> /// <param name="defButton">The default button.</param> /// <param name="showCheckBox">The show check box flag.</param> /// <param name="checkBoxText">The check box text.</param> /// <param name="messageFont">The message font.</param> /// <returns>The dialog result.</returns> public static DialogResultExt Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MsgBoxExtDefaultButton defButton, bool showCheckBox = false, string checkBoxText = "", Font messageFont = null) { return(MsgBoxExtForm.Show(owner, text, caption, buttons, icon, defButton, showCheckBox, checkBoxText, messageFont)); }
/// <summary> /// Shows the extended message box. /// </summary> /// <param name="text">The text.</param> /// <param name="caption">The caption.</param> /// <param name="buttons">The buttons.</param> /// <param name="icon">The icon.</param> /// <param name="defButton">The default button.</param> /// <param name="showCheckBox">The show check box flag.</param> /// <param name="checkBoxText">The check box text.</param> /// <returns>The dialog result.</returns> public static DialogResultExt Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MsgBoxExtDefaultButton defButton = MsgBoxExtDefaultButton.Unknown, bool showCheckBox = false, string checkBoxText = "") { return(MsgBoxExtForm.Show(null, text, caption, buttons, icon, defButton, showCheckBox, checkBoxText)); }
/// <summary> /// Shows the extended message box. /// </summary> /// <param name="text">The text.</param> /// <param name="caption">The caption.</param> /// <param name="buttons">The buttons.</param> /// <param name="icon">The icon.</param> /// <param name="defButton">The default button.</param> /// <returns>The dialog result.</returns> public static DialogResultExt Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MsgBoxExtDefaultButton defButton = MsgBoxExtDefaultButton.Unknown) { return(MsgBoxExtForm.Show(null, text, caption, buttons, icon, defButton)); }