111,120
社区成员
发帖
与我相关
我的任务
分享
for (double i = 0; ; i++)
{
this.Invoke(new Action<double>(AddRow), new Object[] { i });
Thread.Sleep(50);
Application.DoEvents();
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace WindowsApplication264
{
public partial class Form1 : Form
{
DataGridView DGV = new DataGridView();
public Form1()
{
InitializeComponent();
DGV.Parent = this;
DGV.Dock = DockStyle.Fill;
DGV.Columns.Add("c", "c");
new Thread(new ThreadStart(DoThead)).Start();
}
void DoThead()
{
for (double i = 0; ; i++)
this.Invoke(new Action<double>(AddRow), new Object[] { i });
}
void AddRow(double D)
{
DGV.Rows.Add(new Object[] { D });
}
}
}