110,571
社区成员
发帖
与我相关
我的任务
分享
private bool go_check = false;
private bool gb_check = true;
private void ft_go()
{
while (gb_check)
{
la.Text = (int.Parse(la.Text) + 1).ToString();
}
}
private void z_ft_Load(object sender, EventArgs e)
{
Thread td = new Thread(new ThreadStart(ft_go));
td.Start();
}
private void z_ft_FormClosed(object sender, FormClosedEventArgs e)
{
gb_check = false;
td.Abort();
}
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;
using System.Threading;
namespace WindowsFormsApplication23
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
Thread td;
private bool go_check = false;
private bool gb_check = true;
private void ft_go()
{
while (gb_check)
{
la.Text = (int.Parse(la.Text) + 1).ToString();
}
}
private void Form3_Load(object sender, EventArgs e)
{
td = new Thread(new ThreadStart(ft_go));
td.Start();
}
private void Form3_FormClosing(object sender, FormClosingEventArgs e)
{
gb_check = false;
td.Abort();
}
}
}