سلام.
http://www.codeproject.com/Articles/18399/Localizing-System-MessageBox
خودتون هم میتونید یه کد بره مسیج باکس بنویسید و خاصیتهایی مثل عکس، تغییر رنگ زمینه و هر چی که نیاز دارید بهش اضافه کنید:
یه مسیج باکس ساده:
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public enum MessageBoxButton : byte
{
بله,
تاییدانصراف,
بله_خیر
}
public enum DialogResult : byte
{
تایید,
انصراف,
بله,
خیر,
هیچکدام
}
public sealed class MyMessageBox
{
private static DialogResult objDialogResult = DialogResult.هیچکدام;
private static Form form = new Form();
public MyMessageBox()
{
form.Size = new System.Drawing.Size(343, 185);
form.StartPosition = FormStartPosition.CenterScreen;
form.FormBorderStyle = FormBorderStyle.FixedDialog;
form.RightToLeft = RightToLeft.Yes;
form.RightToLeftLayout = true;
form.MinimizeBox = false;
form.MaximizeBox = false;
form.ShowIcon = false;
}
private Button CreateButton(string text, byte xLocation, byte yLocation)
{
Button button = new Button();
button.Location = new System.Drawing.Point(xLocation, yLocation);
button.Text = text.ToString();
return button;
}
private Label CreateLable(string text, byte xLocation, byte yLocation)
{
Label label = new Label();
label.Location = new System.Drawing.Point(xLocation, yLocation);
label.AutoSize = true;
label.Text = text;
return label;
}
private void CreateForm(string text, Label Message, Button Close, Button Ok)
{
form.Controls.Add(Ok);
form.AcceptButton = Ok;
form.Controls.Add(Close);
form.CancelButton = Close;
form.Controls.Add(Message);
form.Text = text;
form.ShowDialog();
form.Controls.Clear();
}
private void CreateForm(string text, Label Message, Button Ok)
{
form.Text = text;
form.Controls.Add(Ok);
form.AcceptButton = Ok;
form.Controls.Add(Message);
form.ShowDialog();
form.Controls.Clear();
}
public static DialogResult Show(string Message)
{
MyMessageBox myMessageBox = new MyMessageBox();
Button __btnOk = myMessageBox.CreateButton("تایید", 126, 112);
__btnOk.Click += btnOk_Click;
myMessageBox.CreateForm(string.Empty, myMessageBox.CreateLable(Message, 12, 29), __btnOk);
return objDialogResult;
}
public static DialogResult Show(string message, string caption)
{
MyMessageBox myMessageBox = new MyMessageBox();
System.Windows.Forms.Button _btnOk = myMessageBox.CreateButton("تایید", 126, 112);
_btnOk.Click += btnOk_Click;
myMessageBox.CreateForm(caption, myMessageBox.CreateLable(message, 12, 29), _btnOk);
return objDialogResult;
}
public static DialogResult Show(string message, string caption, MessageBoxButton button)
{
MyMessageBox myMessageBox = new MyMessageBox();
switch (button)
{
case MessageBoxButton.بله:
Button btnOk = myMessageBox.CreateButton("تایید", 126, 112);
btnOk.Click += btnOk_Click;
myMessageBox.CreateForm(caption, myMessageBox.CreateLable(message, 12, 29), btnOk);
break;
case MessageBoxButton.تاییدانصراف:
Button btnOk1 = myMessageBox.CreateButton("تایید", 65, 112);
btnOk1.Click += btnOk_Click;
Button btnCancel = myMessageBox.CreateButton("انصراف", 186, 112);
btnCancel.Click += btnCancel_Click;
myMessageBox.CreateForm(caption, myMessageBox.CreateLable(message, 12, 29), btnCancel, btnOk1);
break;
case MessageBoxButton.بله_خیر:
Button btnYes = myMessageBox.CreateButton("بله", 65, 112);
btnYes.Click += btnYes_Click;
Button btnNo = myMessageBox.CreateButton("خیر", 186, 112);
btnNo.Click += btnNo_Click;
myMessageBox.CreateForm(caption, myMessageBox.CreateLable(message, 12, 29), btnYes, btnNo);
break;
}
return objDialogResult;
}
#region Events
static void _btnOk_Click(object sender, System.EventArgs e)
{
form.Close();
}
static void btnNo_Click(object sender, System.EventArgs e)
{
objDialogResult = DialogResult.خیر;
form.Close();
}
static void btnYes_Click(object sender, System.EventArgs e)
{
objDialogResult = DialogResult.بله;
form.Close();
}
static void btnCancel_Click(object sender, System.EventArgs e)
{
objDialogResult = DialogResult.انصراف;
form.Close();
}
static void btnOk_Click(object sender, System.EventArgs e)
{
objDialogResult = DialogResult.تایید;
form.Close();
}
#endregion
}
}