使用以下代码即可实现
/// <summary> /// 显示提示消息 /// </summary> /// <param name="msg">需要显示的信息</param> public static void ShowMsg(System.Windows.Forms.IWin32Window window, string msg) { XtraMessageBoxForm form = new XtraMessageBoxForm(); form.Icon = StyleHelper.ApplicationIcon; //需要设置的Icon form.ShowMessageBoxDialog(new XtraMessageBoxArgs(window, msg, "提示信息", new DialogResult[] { DialogResult.OK }, System.Drawing.Icon.FromHandle(System.Drawing.SystemIcons.Information.Handle), 0)); }
其中window参数,可以为null,该参数在多线程中会较常用到