using System; using System.Drawing; using System.IO; using System.Threading; using System.Windows.Forms; using DevExpress.XtraBars.Alerter; using DevExpress.XtraEditors; namespace WindowsFormsApplication1 { public partial class Form2 : XtraForm { public Form2() { InitializeComponent(); } private int alertheight = 0; delegate void DelegateShowAlert(string text); private void ShowAlertControl(string msg) { try { AlertControl alertControl1 = new AlertControl(); alertControl1.AutoFormDelay = 10000;//弹框显示10秒 //alertControl1.LookAndFeel.SkinName = "Office 2007 Blue"; alertControl1.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin; alertControl1.BeforeFormShow += new AlertFormEventHandler(alertControl1_BeforeFormShow); alertControl1.Show(null, "提示信息", msg, File.Exists(Application.StartupPath + "\logo.ico") ? Image.FromFile(Application.StartupPath + "\logo.ico") : null); alertControl1.BeforeFormShow -= new AlertFormEventHandler(alertControl1_BeforeFormShow); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "登录提示信息失败", MessageBoxButtons.OK, MessageBoxIcon.Information); } } private void alertControl1_BeforeFormShow(object sender, AlertFormEventArgs e) { e.AlertForm.Size = new Size(e.AlertForm.Size.Width + 50, 250 + alertheight); } private void simpleButton1_Click(object sender, EventArgs e) { //Thread.Sleep(10000); try { string msg = " 本账号截止当前时间,您OA流程审批界面提醒如下: "; msg += " " + "总共为" + ":0条记录没有审批,请及时处理!"; msg += " 详情请见:OA流程-OA审批流程记录"; this.BeginInvoke(new DelegateShowAlert(ShowAlertControl), new object[] { msg }); Thread.Sleep(1000); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, ex.GetType().ToString()); } } } }