void XYThread() { try { f = new Func(); f.SetDMPath(PicPath); Thread.Sleep(500); int pid = 0, handle = 0; // int plantIndex=this.Invoke(delegate(){return int.Parse(this.cbxPlantIndex.Text.Trim());}); int xyIndex = int.Parse(this.Invoke(new GetControlText(delegate(Control c) { return c.Text; }), new object[] { this.cbxXYIndex }).ToString()); if (this.txtPID.Text.Trim() != "") { pid = int.Parse(txtPID.Text.Trim()); } if (this.txtHandle.Text.Trim() != "") { handle = int.Parse(txtHandle.Text.Trim()); } f.BindDM(ClassName, pid, handle); Thread.Sleep(3000); string xlPath, npcPath; f.ReadyToXY(out xlPath,out npcPath); while (true) { f.XY(xyIndex, xlPath,npcPath); } } catch (Exception ex) { this.Invoke(delegateShowMsg, new object[] { ex.Message }); } }