コード例 #1
0
 //定义更新UI控件的方法
 private void UpdatePosition(Control control, string txt)
 {
     if (control.InvokeRequired)
     {
         this.BeginInvoke((EventHandler) delegate
         {
             while (!control.IsHandleCreated)
             {
                 if (control.Disposing || control.IsDisposed)
                 {
                     return;
                 }
             }
             SetXPosHandle set = new SetXPosHandle(UpdatePosition);
             control.Invoke(set, new object[] { control, txt });
         });
     }
     else
     {
         control.Text = txt;
     }
 }
コード例 #2
0
ファイル: FormMain.cs プロジェクト: tomyqg/MyCShapeStudy
 //定义更新UI控件的方法
 private void UpdatePosition(string txt)
 {
     if (this.txtXLocation.InvokeRequired)
     {
         this.BeginInvoke((EventHandler) delegate
         {
             while (!this.txtXLocation.IsHandleCreated)
             {
                 if (this.txtXLocation.Disposing || this.txtXLocation.IsDisposed)
                 {
                     return;
                 }
             }
             SetXPosHandle set = new SetXPosHandle(UpdatePosition);
             this.txtXLocation.Invoke(set, new object[] { txt });
         });
     }
     else
     {
         this.txtXLocation.Text = txt;
     }
 }