zoukankan      html  css  js  c++  java
  • 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; }
        }
    
    }
    

    效果:
    在这里插入图片描述

  • 相关阅读:
    java设计模式简介
    java设计模式--单例模式
    判断整形回文数
    常用正则表达式 捕获组(分组)
    [转]十分钟搞定Vue搭建
    ActiveX界面已显示,调用方法报undefined的处理办法
    [转]纯js导出json到excel(支持chrome)
    webapi 开启gzip压缩
    webapi下载文件
    iis添加共享目录为虚拟目录
  • 原文地址:https://www.cnblogs.com/AlexanderZhao/p/12878770.html
Copyright © 2011-2022 走看看