zoukankan      html  css  js  c++  java
  • ProgressBar控件

    private void Form1_Load(object sender, EventArgs e)
    {
        progressBar1.Location = new System.Drawing.Point(100, 100);
        progressBar1.Size = new System.Drawing.Size(300, 20);
        progressBar1.Maximum = 200;
        progressBar1.Minimum = 1;
    }
    
    private void button1_Click(object sender, EventArgs e)
    {
        Thread thread = new Thread(new ThreadStart((delegate
        {
            for (int i = 1; i <= 200; i++) //ProcessBar控件最大值是多少,这里i就要小于等于多少,如果小于它,滚动条将到不了尽头
            {
                progressBar1.Value = i; //将进度条的值定义为i的值,每次循环过来加1
                Thread.Sleep(200); //休息200毫秒在往下执行
            }
        })));
        thread.Start();
    }

    添加以下代码,忽略控件多线程的安全机制:

    Control.CheckForIllegalCrossThreadCalls = false;
  • 相关阅读:
    Linux
    python中元类
    POJ 1182 食物链
    POJ 1733 Parity game
    top 介绍
    周记 2014.8.31
    windows10配置python
    oracle执行update时卡死问题的解决办法
    An Easy Introduction to CUDA C and C++
    super()
  • 原文地址:https://www.cnblogs.com/jizhiqiliao/p/9870768.html
Copyright © 2011-2022 走看看