Devexpress通知ウィンドウの単純なアプリケーション-AlertControl

倉庫管理システムを実行する際、倉庫に保管されているアイテムの保管容量が高すぎるとプロンプトが表示されますが、このとき、DevexpressのAlertControlコントロールを使用できます。
AutoFormDelayは、通知フォームが表示される時間を設定できます。
AlertClickイベントは、クリック通知フォーム操作を処理できます。
特定のコード:

using System;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace NotificationApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            Message msg = new Message();
            //显示通知窗体
            alertControl1.Show(this, msg.Caption, msg.Text, "", msg.Image, msg);
        }

        /// <summary>
        /// 设置通知窗体不透明度
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void alertControl1_BeforeFormShow(object sender, DevExpress.XtraBars.Alerter.AlertFormEventArgs e)
        {
            e.AlertForm.OpacityLevel = 1;
        }

        /// <summary>
        /// 处理通知窗体点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void alertControl1_AlertClick(object sender, DevExpress.XtraBars.Alerter.AlertClickEventArgs e)
        {
            Message msg = e.Info.Tag as Message;
            XtraMessageBox.Show(msg.Text, msg.Caption);
        }
    }

    public class Message
    {
        public Message()
        {
            this.Caption = "库存超高告警";
            this.Text = "掘进一队库存材料-铁锨:现有9把";
            this.Image = global::NotificationApp.Properties.Resources.仓储;
        }
        public string Caption { get; set; }
        public string Text { get; set; }
        public Image Image { get; set; }
    }

}

効果:
ここに画像の説明を挿入

177件の元の記事を公開しました 61件の賞賛 170,000回の閲覧

おすすめ

転載: blog.csdn.net/xingkongtianyuzhao/article/details/104727468