欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#?重寫Notification提示窗口的示例代碼

 更新時間:2022年04月17日 10:21:49   作者:huang714  
本文主要介紹了C#?重寫Notification提示窗口的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

這個窗口是右下角提示小窗口,主要用于提示。

private void btnStartNotification_Click(object sender, EventArgs e)
{
			Bz.Controls.BzNotification notification = new Bz.Controls.BzNotification();
			notification.ShowAlert("啟動成功", Bz.Controls.BzNotification.enumType.Success);
}
public partial class BzNotification : Form
{
				public static int Count = 0;
        System.Windows.Forms.Timer timer = new Timer();
        private int x, y;
        public event Action OnNotificationClosed;
        private bool isClosed = false;
        public BzNotification()
        {
            InitializeComponent();
            timer.Enabled = true;
            timer.Tick += Timer_Tick;
        }
 
        private void Timer_Tick(object sender, EventArgs e)
        {
            switch (action)
            {
                case enmAction.wait:
                    timer.Interval = 5000;
                    action = enmAction.close;
                    break;
                case enmAction.start:
                    timer.Interval = 1;
                    this.Opacity += 0.1;
                    if (this.x < this.Location.X)
                    {
                        this.Left--;
                    }
                    else
                    {
                        if (this.Opacity == 1.0)
                        {
                            action = enmAction.wait;
                        }
                    }
                    break;
                case enmAction.close:
                    timer.Interval = 1;
                    this.Opacity -= 0.1;
                    this.Left -= 3;
                    if (base.Opacity == 0.0 && isClosed==false)
                    {
                        isClosed = true;
                        base.Close();
                    }
                    break;
                default:
                    break;
            }
        }
 
        public enum enmAction
        {
            wait,
            start,
            close
        }
 
        public enum enumType
        {
            Success,
            Warning,
            Error,
            Info
        }
 
 
        private enmAction action;
 
 
        public void ShowAlert(string msg, enumType type)
        {
            this.Opacity = 0.0;
            this.StartPosition = FormStartPosition.Manual;
            this.x = Screen.PrimaryScreen.WorkingArea.Width - this.Width + 15;
            this.y = Screen.PrimaryScreen.WorkingArea.Height - this.Height - this.Height*Count-5*Count;
            this.Location = new Point(this.x, this.y);
 
            this.x = Screen.PrimaryScreen.WorkingArea.Width - base.Width - 5;
            switch (type)
            {
                case enumType.Success:
                    picLogo.Image = Properties.Resources.success_icon;
                    this.BackColor = Color.SeaGreen;
                    break;
                case enumType.Error:
                    picLogo.Image = Properties.Resources.error_info;
                    this.BackColor = Color.DarkRed;
                    break;
                case enumType.Info:
                    picLogo.Image = Properties.Resources.info_icon;
                    this.BackColor = Color.RoyalBlue;
                    break;
                case enumType.Warning:
                    picLogo.Image = Properties.Resources.alert_icon;
                    this.BackColor = Color.DarkOrange;
                    break;
            }
            lblMessage.Text = msg;
            this.Show();
            this.action = enmAction.start;
            Count++;
            timer.Interval = 1;
        }
 
        private void picClose_Click(object sender, EventArgs e)
        {
            timer.Interval = 1;
            action = enmAction.close;
            if (Count > 0)
                Count--;
        }
 
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);
            if (OnNotificationClosed != null)
            {
                OnNotificationClosed();
            }
            if (Count > 0)
                Count--;
        }
 
    }

到此這篇關(guān)于C# 重寫Notification提示窗口的示例代碼的文章就介紹到這了,更多相關(guān)C# 重寫Notification提示窗口內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家! 

相關(guān)文章

  • C# 中使用 Exceptionless的方法

    C# 中使用 Exceptionless的方法

    這篇文章主要介紹了C# 中使用 Exceptionless的方法,幫助大家更好的理解和使用c#,感興趣的朋友可以了解下
    2020-12-12
  • C#用委托BeginInvoke做異步線程

    C#用委托BeginInvoke做異步線程

    今天小編就為大家分享一篇關(guān)于C#用委托BeginInvoke做異步線程,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧
    2019-01-01
  • C#實(shí)現(xiàn)計(jì)算器功能

    C#實(shí)現(xiàn)計(jì)算器功能

    這篇文章主要為大家詳細(xì)介紹了C#實(shí)現(xiàn)計(jì)算器功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-01-01
  • C#調(diào)用webservice接口的最新方法教程

    C#調(diào)用webservice接口的最新方法教程

    webservice 可以用于分布式應(yīng)用程序之間的交互,和不同程序之間的交互。下面這篇文章主要給大家介紹了關(guān)于C#調(diào)用webservice接口的相關(guān)資料,文中通過圖文介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友下面隨著小編來一起看看吧。
    2017-11-11
  • c# 單例模式的實(shí)現(xiàn)方法

    c# 單例模式的實(shí)現(xiàn)方法

    這篇文章主要介紹了c# 單例模式的實(shí)現(xiàn)方法,文中講解非常細(xì)致,代碼幫助大家更好的理解和學(xué)習(xí),感興趣的朋友可以了解下
    2020-08-08
  • C#實(shí)例化和靜態(tài)類對象調(diào)用對比

    C#實(shí)例化和靜態(tài)類對象調(diào)用對比

    這篇文章主要介紹了C#實(shí)例化和靜態(tài)類對象調(diào)用對比,什么時候用實(shí)例化對象,什么時候用靜態(tài)類對象,內(nèi)存和生命周期又是如何,框架本身的回收機(jī)制是什么,下文詳細(xì)解說需要的小伙伴可以參考一下
    2022-04-04
  • C#透明窗體實(shí)現(xiàn)方法

    C#透明窗體實(shí)現(xiàn)方法

    這篇文章主要介紹了C#透明窗體實(shí)現(xiàn)方法,涉及C#窗體操作的相關(guān)技巧,需要的朋友可以參考下
    2015-06-06
  • C#中的預(yù)處理器指令詳解

    C#中的預(yù)處理器指令詳解

    這篇文章主要介紹了C#中的預(yù)處理器指令詳解,本文講解了#define 和 #undef、#if、#elif、#else和#endif、#warning和#error、#region和#endregion、#line、#pragma等預(yù)處理器指令,需要的朋友可以參考下
    2015-01-01
  • C#使用opencv截取旋轉(zhuǎn)矩形區(qū)域圖像的實(shí)現(xiàn)示例

    C#使用opencv截取旋轉(zhuǎn)矩形區(qū)域圖像的實(shí)現(xiàn)示例

    這篇文章主要介紹了C#使用opencv截取旋轉(zhuǎn)矩形區(qū)域圖像,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-03-03
  • C#中如何使用Chart圖表問題

    C#中如何使用Chart圖表問題

    這篇文章主要介紹了C#中如何使用Chart圖表問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-11-11

最新評論