易忘

来源:互联网 发布:sql 清空数据库 编辑:程序博客网 时间:2024/05/18 03:07

progressBar1控件:

            progressBar1.PerformStep();
            progressBar1.Maximum = 100;

            progressBar1.Minimum = 0;

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.label1.Text = System.DateTime.Now.ToString();
            if (progressBar1.Value < 100)
            {
                this.progressBar1.Value += 1;
            }
            this.progressBar1.Increment(5);
            if (progressBar1.Value >= 100)
            {
                this.timer1.Stop();
                MessageBox.Show("显示完毕!");
                return;
            }
        }

------------------------------------------------------------------------

事件与委托

创建代理
delegate void SetTextCallback(string text);

创建和启动线程
this.demoThread =
               new Thread(new ThreadStart(this.ThreadProcUnsafe));
                this.demoThread.Start();

线程中要求改主窗体UI中的text属性
private void ThreadProcSafe()
         {
             this.SetText("This text was set safely.");
         }

调用窗体中的函数用invoke传递参数
private void SetText(string text)
         {
            if (this.textBox1.InvokeRequired)
             {    
                 SetTextCallback d = new SetTextCallback(SetText);
                 this.Invoke(d, new object[] { text });
             }
             else
             {
                 this.textBox1.Text = text;
             }
         }

 ================================

CodeProject    English 英语不错的同志进

http://www.codeproject.com

 

C#连接Access数据库

strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "//book.mdb";

将Access的宏设置为最低,否则提示错误.

 

asp.net生成曲线图网址

 http://www.ngiv.net/ngivHtml/program/aspnet/2010/0702/2408.html

原创粉丝点击