使用线程更改标签文本-C#

时间:2016-04-01 12:56:28

标签: c# multithreading winforms delegates

我需要使用线程将数组的成员逐个显示到标签中。线程需要每秒更改内容。我怎么能实现这个目标?

我的代码如下:

private void Form1_Load(object sender, EventArgs e)
{
    string[] heartRate = new String[] {"153","155","157","155","153","154"};
    myThread display = new myThread();

    display.hr =  Array.ConvertAll(heartRate, num => Int32.Parse(num));

    Thread threadHeartRate = new Thread(display.threadHeartrate);   
}

public class myThread
{
    private int[] _hr;
    internal int[] hr  {get { return _hr; } set { _hr = value; } }
    public void threadHeartrate()
    {
        for (int i = 0; i < _hr.Length; i++)
        {

        }
    }
}

我需要打印的数组是heartRate

0 个答案:

没有答案