展开全部
给你贴出后台代码
给噶个实例!
public partial class Form1 : Form
{
private static bool stopStatus = false;
private static int finishTime = 0;
private static int numIndex = 0;
private static string passNum = string.Empty;
public Form1()
{
InitializeComponent();
CheckForIllegalCrossThreadCalls = false;
}
private void btnBegin_Click(object sender, EventArgs e)
{
stopStatus = false;
Thread changeTimeThread = new Thread(ChangeTime);
changeTimeThread.IsBackground = true;
changeTimeThread.Start();
}
private void ChangeTime()
{
while (!stopStatus)
{
string hasFinishedTime = "";
if (finishTime / 60 >= 10)
{
hasFinishedTime = (finishTime / 60).ToString();
}
else
{
hasFinishedTime = "0" + finishTime / 60;
}
hasFinishedTime += ":";
int secondTime = finishTime - (finishTime / 60) * 60;
if (secondTime / 10 >= 1)
{
hasFinishedTime += secondTime;
}
else
{
hasFinishedTime += "0" + secondTime;
}
finishTime++;
this.time.Text = "时间已过:" + hasFinishedTime;
Thread.Sleep(1000);
}
}
private void btnStop_Click(object sender, EventArgs e)
{
stopStatus = true;
btnBegin.Enabled = true;
btnNext.Enabled = false;
}
前台控件自己定义就可以了!
Good Luck! 希望能够帮助到你!
如果能够帮助到你,请采纳!谢谢!
2014-12-23
展开全部
没分,懒得做
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询