8,737
社区成员
发帖
与我相关
我的任务
分享
Thread thrd = new Thread(new ThreadStart(() =>
{
while (true)
{
this.Dispatcher.Invoke(new Action(() =>
{
image= imagepng;//imagepng数据在后台读取,读取过程没有贴上来
}));
}}));
thrd.Start();
//由于PictureBox1、Button_InsertSatelliteMapImage、ProgressBar1等均被涉及于线程,所以需要进行线程安全设置。
delegate void PictureBoxRefreshDelegate(); // 线程刷新picturebox1
private void PictureBoxRefresh() // 线程刷新picturebox1
{
if (PictureBox1.InvokeRequired)
{
PictureBoxRefreshDelegate d = new PictureBoxRefreshDelegate(PictureBoxRefresh);
this.Invoke(d);
}
else
{
PictureBox1.Refresh();
}
}