public override int GetHashCode() { var result = 0; result = (result * 397) ^ (Message == null ? 0 : Message.GetHashCode()); result = (result * 397) ^ (Caption == null ? 0 : Caption.GetHashCode()); result = (result * 397) ^ MessageBoxButton.GetHashCode(); result = (result * 397) ^ MessageBoxIcon.GetHashCode(); result = (result * 397) ^ RequiresSpecialCall.GetHashCode(); return(result); }
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) { if (time == 0) { return(MessageBox.Show(text, caption, buttons, icon)); } else { return((DialogResult)MessageBoxTimeoutA(IntPtr.Zero, text, caption, buttons.GetHashCode() | icon.GetHashCode() | MessageBoxDefaultButton.Button1.GetHashCode(), 0, time)); } }
/// <summary> /// Plays one of the system message beeps. /// </summary> /// <param name="icon">Sound type to play.</param> private void MessageBeep(MessageBoxIcon icon) { switch (icon.GetHashCode()) { case 0: System.Media.SystemSounds.Beep.Play(); break; case 16: System.Media.SystemSounds.Hand.Play(); break; case 32: System.Media.SystemSounds.Question.Play(); break; case 48: System.Media.SystemSounds.Exclamation.Play(); break; case 64: System.Media.SystemSounds.Asterisk.Play(); break; } }
/// <summary> /// Sets icon for the message box. /// </summary> /// <param name="icon">Icon type.</param> private void SetIconToDisplay(MessageBoxIcon icon) { switch (icon.GetHashCode()) { case 0: break; case 16: msgIcon.Image = SystemIcons.Hand.ToBitmap(); break; case 32: msgIcon.Image = SystemIcons.Question.ToBitmap(); break; case 48: msgIcon.Image = SystemIcons.Exclamation.ToBitmap(); break; case 64: msgIcon.Image = SystemIcons.Asterisk.ToBitmap(); break; } }