Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to rewrite Notification prompt window in C #

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces C # how to rewrite Notification prompt window related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this C# how to rewrite Notification prompt window article will have a harvest, let's take a look.

This window is a small prompt window in the lower right corner, mainly for prompts.

Private void btnStartNotification_Click (object sender, EventArgs e) {Bz.Controls.BzNotification notification = new Bz.Controls.BzNotification (); notification.ShowAlert ("started successfully", 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-- }} this is the end of the article on "how to rewrite the Notification prompt window in C #". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to rewrite the Notification prompt window in C#". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

  • How to use the swagger of Springboot project interface

    This article introduces how to use the swagger of the Springboot project interface. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you. Step1:pom file introduces swagger plug-in

    © 2024 shulou.com SLNews company. All rights reserved.

    12
    Report