Simple application of Devexpress notification window-AlertControl

When doing a warehouse management system, if the storage capacity of the warehoused items is too high, a prompt will be given. At this time, you can use the AlertControl control of Devexpress.
AutoFormDelay can set the time that the notification form is displayed.
The AlertClick event can handle click notification form operations.
Specific code:

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; }
    }

}

effect:
Insert picture description here

Published 177 original articles · 61 praises · 170,000 views

Guess you like

Origin blog.csdn.net/xingkongtianyuzhao/article/details/104727468