public static DialogResult Show(string Message, string Caption) { KryptonMessageBoxStd mb = new KryptonMessageBoxStd(); mb.Text = Caption; mb.rtbMessage.Text = Message; mb.btnOK.Visible = true; //mb.btnOK.Text = AC.ExtendedRenderer.Toolkit.Properties.Resources.cptOK; mb.pbIcon.Visible = false; SystemSounds.Exclamation.Play(); mb.ShowDialog(); return(mb.DialogResult); }
public static DialogResult Show(string Message, string Caption, MessageBoxButtons Buttons, MessageBoxIcon Icon) { KryptonMessageBoxStd mb = new KryptonMessageBoxStd(); mb.Text = Caption; mb.rtbMessage.Text = Message; switch (Buttons) { case MessageBoxButtons.AbortRetryIgnore: mb.btnAbort.Visible = true; mb.btnRetry.Visible = true; mb.btnIgnore.Visible = true; break; case MessageBoxButtons.OK: mb.btnOK.Visible = true; break; case MessageBoxButtons.OKCancel: mb.btnOK.Visible = true; mb.btnCancel.Visible = true; mb.btnOK.Location = new Point(59, 14); mb.btnCancel.Location = new Point(159, 14); break; case MessageBoxButtons.RetryCancel: mb.btnRetry.Visible = true; mb.btnCancel.Visible = true; mb.btnRetry.Location = new Point(59, 14); mb.btnCancel.Location = new Point(159, 14); break; case MessageBoxButtons.YesNo: mb.btnYes.Visible = true; mb.btnNo.Visible = true; mb.btnYes.Location = new Point(59, 14); mb.btnNo.Location = new Point(159, 14); break; case MessageBoxButtons.YesNoCancel: mb.btnYes.Visible = true; mb.btnNo.Visible = true; mb.btnCancel.Visible = true; break; default: //this.btnOK.Visible = true; break; } Point PIcon = new Point(mb.rtbMessage.Location.X, mb.rtbMessage.Location.Y); Size SIcon = new Size(mb.rtbMessage.Size.Width, mb.rtbMessage.Size.Height); switch (Icon) { case MessageBoxIcon.Asterisk: mb.pbIcon.Image = SystemIcons.Asterisk.ToBitmap(); //mb.pbIcon.Image = mb.ilIcons.Images[0]; mb.rtbMessage.Location = new Point(mb.rtbMessage.Location.X + 63, mb.rtbMessage.Location.Y); mb.rtbMessage.Width = mb.rtbMessage.Size.Width - 63; SystemSounds.Asterisk.Play(); break; case MessageBoxIcon.Error: mb.pbIcon.Image = SystemIcons.Error.ToBitmap(); //mb.pbIcon.Image = mb.ilIcons.Images[2]; mb.rtbMessage.Location = new Point(mb.rtbMessage.Location.X + 63, mb.rtbMessage.Location.Y); mb.rtbMessage.Width = mb.rtbMessage.Size.Width - 63; SystemSounds.Exclamation.Play(); break; case MessageBoxIcon.Exclamation: mb.pbIcon.Image = SystemIcons.Exclamation.ToBitmap(); //mb.pbIcon.Image = mb.ilIcons.Images[3]; mb.rtbMessage.Location = new Point(mb.rtbMessage.Location.X + 63, mb.rtbMessage.Location.Y); mb.rtbMessage.Width = mb.rtbMessage.Size.Width - 63; SystemSounds.Exclamation.Play(); break; case MessageBoxIcon.None: mb.pbIcon.Visible = false; mb.pbIcon.Image = SystemIcons.Question.ToBitmap(); //SystemSounds.Exclamation.Play(); //pbIcon.Image = this.ilIcons.Images[0]; //rtbMessage.Location = new Point(rtbMessage.Location.X + 63,rtbMessage.Location.Y); //this.rtbMessage..Width = rtbMessage.Size.Width - 63; break; case MessageBoxIcon.Question: mb.pbIcon.Image = SystemIcons.Question.ToBitmap(); //mb.pbIcon.Image = mb.ilIcons.Images[1]; mb.rtbMessage.Location = new Point(mb.rtbMessage.Location.X + 63, mb.rtbMessage.Location.Y); mb.rtbMessage.Width = mb.rtbMessage.Size.Width - 63; SystemSounds.Question.Play(); break; default: //this.btnOK.Visible = true; break; } mb.ShowDialog(); mb.rtbMessage.Location = PIcon; mb.rtbMessage.Size = SIcon; //mb.pbIcon.Image = null; mb.ResetButtonsLocation(); return(mb.DialogResult); }