Avoid calling Invoke when the control is disposed

后端 未结 14 1456
花落未央
花落未央 2020-12-01 16:09

I have the following code in my worker thread (ImageListView below is derived from Control):

if (mImageListView != null &&          


        
14条回答
  •  情歌与酒
    2020-12-01 16:41

    This works for me

    if (this.IsHandleCreated){
        Task.Delay(500).ContinueWith(_ =>{
            this.Invoke(fm2);
        });
    } else {
      this.Refresh();
    }
    

提交回复
热议问题