您的位置:首页 > 其它

安装salt客户端出现错误

2015-12-17 16:05 274 查看
自己写的一个使用线程和最小化到托盘的例子。 例子下载
当你看这个例子你就知道线程的强大了,:-)

<script type="text/javascript"><!--
google_ad_client = "pub-4334685396432654";
//728x90, 创建于 07-12-2
google_ad_slot = "4549597583";
google_ad_width = 728;
google_ad_height = 90;
//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>


using System;


using System.Collections.Generic;


using System.ComponentModel;


using System.Data;


using System.Drawing;


using System.Text;


using System.Windows.Forms;


using System.Threading;


using System.Diagnostics;




namespace thread






{


    public partial class Form1 : Form




    

{


        Thread t1;


           


        public Form1()




        

{


        


            InitializeComponent();


            this.notifyIcon1.Visible = false;


            System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;


        }




        private void button1_Click(object sender, EventArgs e)




        

{


            t1 = new Thread(new ThreadStart(BackGroudProcess));


            t1.Start();




        }




        private void BackGroudProcess()




        

{


            int i = 1;


            while (true)




            

{


                listBox1.Items.Add("Iterations:" + i.ToString());


                i++;


                


            }


        }




        private void button2_Click(object sender, EventArgs e)




        

{


            t1.Abort();


        }




        private void button3_Click(object sender, EventArgs e)




        

{


            int i = 1;


            while (true)




            

{


                listBox1.Items.Add("Iterations:" + i.ToString());


                i++;




            }


        }




        private void Form1_Resize(object sender, EventArgs e)




        

{


            if (WindowState == FormWindowState.Minimized)




            

{


                this.Visible = false;


                this.notifyIcon1.Visible = true;


            }


        }




        private void notifyIcon1_Click(object sender, EventArgs e)




        

{


            this.Visible = true;


            WindowState = FormWindowState.Normal;


            this.notifyIcon1.Visible = false;


        }




        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)




        

{


            System.Diagnostics.Process.Start("http://wuyisky.cnblogs.com");


        }




    }


}

源码下载
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: