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 的摘要说明。
/// </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>
/// 必需的设计器变量。
/// </summary>
private system.componentmodel.container components = null;
public form1()
{
//
// windows 窗体设计器支持所必需的
//
initializecomponent();
//
// tod 在 initializecomponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.dispose();
}
}
base.dispose( disposing );
}
#region windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </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>
/// 应用程序的主入口点。
/// </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;
}
}
}
}
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
C#实现猜数字游戏
本文实例为大家分享了c#实现猜数字游戏具体代码,供大家参考,具体内容如下给定一个0-100的随机数字猜其大小题目样式:电脑产生一个0到100之间的随机数字,并且...
[阅读全文]
-
-
C# 可空类型的具体使用
在项目中我们经常会遇到可为空类型,那么到底什么是可为空类型呢?下面我们将从4个方面为大家剖析。1、可空类型基础知识顾名思义,可空类型指的就是某个对象类型可以为空...
[阅读全文]
-
-
-
C#实现猜数字小游戏
本文实例为大家分享了c#实现猜数字小游戏的具体代码,供大家参考,具体内容如下效果如图:代码:using system;using system.collecti...
[阅读全文]
-
-
C#实现简单俄罗斯方块
最近在看《.net游戏编程入门经典 c#篇》 第一章介绍了如何制作俄罗斯方块,自己试了试按照书上的步骤,可算是完成了。于是写下这篇文章留作纪念。1.类的设计在充...
[阅读全文]
-
网友评论