C#进度条怎么用 / C#progressBar的用法
展开全部
主要就是最大、最小和当前值。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
Random rnd = new Random();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int i = (progressBar1.Value + rnd.Next(1000)) % progressBar1.Maximum;
progressBar1.Value = i;
}
private void Form1_Load(object sender, EventArgs e)
{
progressBar1.Maximum = 10000;
progressBar1.Minimum = 0;
progressBar1.Value = 0;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
Random rnd = new Random();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int i = (progressBar1.Value + rnd.Next(1000)) % progressBar1.Maximum;
progressBar1.Value = i;
}
private void Form1_Load(object sender, EventArgs e)
{
progressBar1.Maximum = 10000;
progressBar1.Minimum = 0;
progressBar1.Value = 0;
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询