国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開發(fā) > 綜合 > 正文

C#中使用進(jìn)度條

2024-07-21 02:26:24
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

using system;
using system.drawing;
using system.collections;
using system.componentmodel;
using system.windows.forms;
using system.data;
using system.diagnostics;
using system.threading;
namespace windowsapplication2
{
 /// <summary>
 /// form1 的摘要說(shuō)明。
 /// </summary>
 public class form1 : system.windows.forms.form
 {
  private system.windows.forms.button button1;
  private system.windows.forms.progressbar progressbar1;
  private system.windows.forms.progressbar progressbar2;
  private system.windows.forms.textbox textbox1;
  private system.windows.forms.textbox textbox2;
  /// <summary>
  /// 必需的設(shè)計(jì)器變量。
  /// </summary>
  private system.componentmodel.container components = null;

  public form1()
  {
   //
   // windows 窗體設(shè)計(jì)器支持所必需的
   //
   initializecomponent();

   //
   // todo: 在 initializecomponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼
   //
  }

  /// <summary>
  /// 清理所有正在使用的資源。
  /// </summary>
  protected override void dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.dispose();
    }
   }
   base.dispose( disposing );
  }

  #region windows 窗體設(shè)計(jì)器生成的代碼
  /// <summary>
  /// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
  /// 此方法的內(nèi)容。
  /// </summary>
  private void initializecomponent()
  {
   this.button1 = new system.windows.forms.button();
   this.progressbar1 = new system.windows.forms.progressbar();
   this.progressbar2 = new system.windows.forms.progressbar();
   this.textbox1 = new system.windows.forms.textbox();
   this.textbox2 = new system.windows.forms.textbox();
   this.suspendlayout();
   //
   // button1
   //
   this.button1.location = new system.drawing.point(160, 184);
   this.button1.name = "button1";
   this.button1.tabindex = 1;
   this.button1.text = "button1";
   this.button1.click += new system.eventhandler(this.button1_click);
   //
   // progressbar1
   //
   this.progressbar1.enabled = false;
   this.progressbar1.location = new system.drawing.point(32, 16);
   this.progressbar1.name = "progressbar1";
   this.progressbar1.size = new system.drawing.size(336, 32);
   this.progressbar1.tabindex = 2;
   //
   // progressbar2
   //
   this.progressbar2.location = new system.drawing.point(32, 72);
   this.progressbar2.name = "progressbar2";
   this.progressbar2.size = new system.drawing.size(328, 24);
   this.progressbar2.tabindex = 3;
   //
   // textbox1
   //
   this.textbox1.location = new system.drawing.point(48, 136);
   this.textbox1.name = "textbox1";
   this.textbox1.tabindex = 4;
   this.textbox1.text = "100";
   //
   // textbox2
   //
   this.textbox2.location = new system.drawing.point(216, 136);
   this.textbox2.name = "textbox2";
   this.textbox2.tabindex = 5;
   this.textbox2.text = "100";
   //
   // form1
   //
   this.autoscalebasesize = new system.drawing.size(6, 14);
   this.backcolor = system.drawing.systemcolors.desktop;
   this.clientsize = new system.drawing.size(408, 222);
   this.controls.add(this.textbox2);
   this.controls.add(this.textbox1);
   this.controls.add(this.progressbar2);
   this.controls.add(this.progressbar1);
   this.controls.add(this.button1);
   this.name = "form1";
   this.text = "form1";
   this.resumelayout(false);

  }
  #endregion

  /// <summary>
  /// 應(yīng)用程序的主入口點(diǎn)。
  /// </summary>
  [stathread]
  static void main()
  {
   application.run(new form1());
  }

  private void button1_click(object sender, system.eventargs e)
  {
    int outloop = int32.parse(textbox1.text);
    int innerloop = int32.parse(textbox2.text);

   for (int i=1;i<=outloop;i++)
   {
    for (int j=i;j<=innerloop;j++)
    {
     if (j%10 == 0)
     {
      progressbar2.value = j;
      thread.sleep(100);
     }
    }
    progressbar1.value = i;
   }
  }
 }
}

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 安岳县| 宜黄县| 平安县| 从江县| 南靖县| 久治县| 丘北县| 滨州市| 琼中| 方山县| 吉隆县| 丰宁| 赞皇县| 同仁县| 淅川县| 合肥市| 绍兴市| 吉隆县| 吉林市| 会泽县| 宁远县| 阳城县| 龙南县| 云浮市| 札达县| 白河县| 沈阳市| 五原县| 商城县| 平原县| 江陵县| 福鼎市| 泰州市| 北宁市| 汝城县| 高青县| 象山县| 龙海市| 新巴尔虎左旗| 龙陵县| 广汉市|