dev右下角增長彈框提示信息

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 = "\r\n本帳號截止當前時間,您OA流程審批界面提醒以下:\r\n";
                msg += "\r\n" + "總共爲" + ":0條記錄沒有審批,請及時處理!";
                msg += "\r\n詳情請見:OA流程-OA審批流程記錄";

                this.BeginInvoke(new DelegateShowAlert(ShowAlertControl), new object[] { msg });
                Thread.Sleep(1000);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, ex.GetType().ToString());
            }
        }


    }
}
相關文章
相關標籤/搜索