如题,有没有办法改变MessageShow.show()对话框的背景颜色?求高手DialogResult result = MessageBox.Show(Properties.Resources.msgIsQuit, "退出系统",
MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
解决方案 »
- 备份数据库时出错!!!
- 新手请教:线程类问题
- [新手问题]如何使用这个通用库?
- vs2005刚刚装好,新建了一个window程序,但是打不开窗体设计器
- 如何用C#在本地建立mdb文件并操作它
- - - ! 刚学习电脑编程,求大神给点资源
- C#中如何处理(增加和读取)ORACLE中的对象数据
- c#初学的问题
- 明天去应聘,项目经理出了个问题,我现在解决不了,求高手帮助!(再线等待)
- ##拆分字符串,string str="请修改"把这三个字,分别拆成"请","修","改",请教高人,今天我头晕了
- mdi中的子窗体为何不能最大化呢?真是怪了。
- 应用xsd架构的xml,用xPath查询不出节点值,为何啊?着急死啦
A Custom Message Box - CodeProject
http://www.codeproject.com/KB/cs/A_Custom_Message_Box.aspx
参考MSDN
private string InputBox(string Caption, string Hint, string Default)
{
//by 闫磊 Email:[email protected],[email protected] 2007.10.10
Form InputForm = new Form();
InputForm.MinimizeBox = false;
InputForm.MaximizeBox = false;
InputForm.ControlBox = false;
//InputForm.StartPosition = FormStartPosition.CenterScreen;
InputForm.Location = new Point(50, 100);
InputForm.Width = 220;
InputForm.Height = 150;
//InputForm.Font.Name = "宋体";
//InputForm.Font.Size = 10; InputForm.Text = Caption;
Label lbl = new Label();
lbl.Text = Hint;
lbl.Left = 10;
lbl.Top = 20;
lbl.Parent = InputForm;
lbl.Size = new Size(120, 21);
//lbl.AutoSize = true;
TextBox tb = new TextBox();
tb.Left = 30;
tb.Top = 45;
tb.Width = 160;
tb.Parent = InputForm;
tb.Text = Default;
tb.PasswordChar = '*';
tb.SelectAll();
Button btnok = new Button();
btnok.Left = 80;
btnok.Top = 80;
btnok.Parent = InputForm;
btnok.Text = "确定";
//InputForm.AcceptButton = btnok; //回车响应
btnok.DialogResult = DialogResult.OK; //Button btncancal = new Button();
//btncancal.Left = 120;
//btncancal.Top = 80;
//btncancal.Parent = InputForm;
//btncancal.Text = "取消";
//btncancal.DialogResult = DialogResult.Cancel;
try
{
if (InputForm.ShowDialog() == DialogResult.OK)
{
return tb.Text.Trim();
}
else
{
return null;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return null;
}
finally
{
InputForm.Dispose();
}
}
说实话,这叫做吃饱了撑的。