先上代码
public static void ShowOverAll(string text, DialogResult[] buttons, Icon icon)
{
XtraForm _test = new XtraForm();
XtraMessageBoxForm form = new XtraMessageBoxForm();
Font _MessageFont = new Font("微软雅黑", 9); //字体大小和字体类型
form.Appearance.Font = _MessageFont;
form.Appearance.ForeColor = System.Drawing.Color.Black; //字体颜色
form.Appearance.Options.UseFont = true;
form.Appearance.Options.UseForeColor = true;
form.MaximumSize = new Size(550, 1000);
form.ShowMessageBoxDialog(
new XtraMessageBoxArgs(DLookAndFeel.LookAndFeel,
_test,
text,
"操作提示",
buttons,
icon
, 0)
);
对于DevExpree第三方控件了解不深,但是公司要求要用,所以以后会经常研究~
对于Dev中的自带的消息提示,XtraMessageBox,只能说伤不起。因为暂时不会修改其属性!所以找到了大牛们的代码。经过一番设置终于达到自己想要的结果。但是也有不方便的地方。就是要把所有的应用到消息提示框的地方加上这两个控件 而XtraMessageBox传参问题我是这样定义的
public static DialogResult MessBoxQuesYesNoCancel(string infoMess)
{
return XtraMessageBox.Show(DLookAndFeel.LookAndFeel, infoMess, "操作提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
}
要想将XtraMessageBoxArgs方法中的参数设为一致还需要把参数直接定义为死的值!就是这样了,虽然投机取巧,但是同样可以实现自己想要的效果!