1、创建委托
private delegate void AddImageToPicturboxCallBack(string imageAddress);
2、 创建委托的方法
private void AddImageToPicturbox(string imageAddree)
{
if (pictureBox1.InvokeRequired)
{
AddImageToPicturboxCallBack d1 = new AddImageToPicturboxCallBack(AddImageToPicturbox);
this.Invoke(d1, new object[] { imageAddree});
}
else
{
pictureBox1.Image = Image.FromFile(imageAddree, false);
}
}
3、直接调用方法即可
AddImageToPicturbox(pi.Address);