用C#编程,利用里边的lable和timer,循环输出1-500的程序怎么编?
2012-06-05
展开全部
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
int i=0;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
timer1.Interval = 1000;
timer1.Enabled = true;
label1.Text = 0;
}
private void timer1_Tick(object sender, EventArgs e)
{
i++;
if (i > 500)
i = 1;
label1.Text = i.ToString();
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
int i=0;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
timer1.Interval = 1000;
timer1.Enabled = true;
label1.Text = 0;
}
private void timer1_Tick(object sender, EventArgs e)
{
i++;
if (i > 500)
i = 1;
label1.Text = i.ToString();
}
}
}
追问
label1.Text = 0;
这句话的时候说无法将int隐式转成string 。非常感谢!还有可以留个qq么?我还有一些问题想问你。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询