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 use C # thread to make pop-up window effect

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

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "how to use C# thread to make pop-up window effect", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article, let's take a look at this article "how to use C# thread to make pop-up window effect" article.

First create a ShowFrom form in which two buttons are placed to confirm and cancel, respectively.

Add the following events to the button

Private void btn_ok_Click (object sender, EventArgs e) {this.DialogResult = DialogResult.OK; this.Close ();} private void btn_cancle_Click (object sender, EventArgs e) {this.DialogResult = DialogResult.Cancel; this.Close ();}

You can call the pop-up window by establishing the following function in the main form

Public static bool MsgShow (string msg = "undefined action prompt", bool bcancel = false) {/ / device pauses, beep starts / / VAR.gsys_set.beep_en = true Task mtask = new Task (() = > {lock (WarnObj) {warning frWarning = new warning (); / / error form frWarning.TopMost = true; frWarning.BackColor = Color.Yellow FrWarning.lb_msg.Text = msg; if (bcancel) {frWarning.btn_cancle.Visible = true; frWarning.btn_cancle.Enabled = true } frWarning.ShowDialog (); VAR.msg.AddMsg (Msg.EM_MSGTYPE.SAVE_WAR, string.Format ("{0}", msg)) If (frWarning.DialogResult = = DialogResult.OK) {frWarning.Dispose (); return true;} else {frWarning.Dispose () Return false;}); mtask.Start (); mtask.Wait (); return mtask.Result } private void button1_Click_1 (object sender, EventArgs e) {var ret = actiom.MsgShow ("ceshi", true); if (ret) MessageBox.Show ("ok"); else MessageBox.Show ("err");}

Results:

The above is about the content of this article on "how to make pop-up window effect with C # thread". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please pay attention to 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

Wechat

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

12
Report