public void NewDoProject(LD.Config.PlcDataItem PlcItem, Object Obj) { LD.Common.PlcDevice plcDevice = PlcItem.PlcDevice; if (plcDevice == LD.Common.PlcDevice.ArtTestCameraStart) // { //读取机台编号 int StageNum = (int)LD.Logic.PlcHandle.Instance.ReadValue(LD.Common.PlcDevice.ArtTestStageNumRead); //读取拍照位编号 int GrabNum = (int)LD.Logic.PlcHandle.Instance.ReadValue(LD.Common.PlcDevice.ArtTestGrabNum); //获取视觉示教的定位参数 NowProjectPara = ProjectParaManager.Instance.GetProjectPara(StageNum); //获取当前拍照点的视觉坐标 NowVisionPara = NowProjectPara.GetVisionPara(GrabNum); NowVisionProcess.SetVisionPara(NowVisionPara); NowVisionProcess.Do(); FirstLocalResult = NowVisionProcess.MyLocalResult; St_VectorAngle PosToRot = NowVisionProcess.PosToRot; St_VectorAngle TeachPosToRot = NowVisionProcess.TeachPosToRot; St_VectorAngle AddVector = new St_VectorAngle(); MyVisionBase.VectorAngleToMotionXYTh(PosToRot, TeachPosToRot, out AddVector); LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.ArtTestAddX, -AddVector.Col); LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.ArtTestAddY, AddVector.Row); LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.ArtTestAddTheta, -AddVector.Angle); ViewControl view1 = DisplaySystem.GetViewControl(CameraTest.UpCam1); } }
public bool Save() { bool IsOk = true; string ExePath = System.Environment.CurrentDirectory; DirectoryEx.DeleteFolder1(ExePath + @"\" + ParaPath); if (!DirectoryEx.Exist(ExePath + @"\" + ParaPath)) { DirectoryEx.Create(ExePath + @"\" + ParaPath); } IsOk = IsOk && XML <List <ProjectMsg> > .Write(this.ProjectMsgList, ExePath + @"\" + ParaPath + @"\" + "ProjectMsgList.xml"); ProjectPara ProjectParaI = new ProjectPara(); for (int i = 0; i < this.ProjectMsgList.Count(); i++) { ProjectParaI = this.ProjectParaList[i]; IsOk = IsOk && ProjectParaI.Save(ExePath + @"\" + ParaPath + @"\" + i.ToString() + this.ProjectMsgList[i].ProjectDescribe + @"\"); } return(IsOk); }
public bool Read() { bool IsOk = true; string ExePath = System.Environment.CurrentDirectory; ProjectMsgList = XML <List <ProjectMsg> > .Read(ExePath + @"\" + ParaPath + @"\" + "ProjectMsgList.xml"); ProjectPara ProjectParaI = new ProjectPara(); if (this.ProjectMsgList == null) { this.ProjectParaList = new List <ProjectPara>(); return(true); } for (int i = 0; i < ProjectMsgList.Count(); i++) { ProjectParaI = new ProjectPara(); IsOk = IsOk && ProjectParaI.Read(ExePath + @"\" + ParaPath + @"\" + i.ToString() + this.ProjectMsgList[i].ProjectDescribe + @"\"); this.ProjectParaList.Add(ProjectParaI); } return(IsOk); }
public void Init() { MyProjectPara = ProjectParaManager.Instance.GetProjectPara(0); RightDnLeftVisionPara = MyProjectPara.GetVisionPara("右侧下相机左上角拍照位"); RightDnRightVisionPara = MyProjectPara.GetVisionPara("右侧下相机右下角拍照位"); UpCamLeftDnVisionPara = MyProjectPara.GetVisionPara("上相机左上角拍照位2"); UpCamRightDnVisionPara = MyProjectPara.GetVisionPara("上相机右下角拍照位2"); RightDnCamLeftStaView = DisplaySystem.GetViewControl("右侧下相机左上角拍照位"); RightDnCamRightStaView = DisplaySystem.GetViewControl("右侧下相机右下角拍照位"); UpCamLeftDnStaView = DisplaySystem.GetViewControl("上相机左上角拍照位2"); UpCamRightDnStaView = DisplaySystem.GetViewControl("上相机右下角拍照位2"); VisionStateUpCamLeftDn = new VisionStateBase(UpCamLeftDnVisionPara, "右侧下相机左上角拍照位", UpCamLeftDnStaView); VisionStateUpCamRightDn = new VisionStateBase(UpCamRightDnVisionPara, "右侧下相机右下角拍照位", UpCamRightDnStaView); VisionStateRightDnCamLeft = new VisionStateBase(RightDnLeftVisionPara, "上相机左上角拍照位2", RightDnCamLeftStaView); VisionStateRightDnCamRight = new VisionStateBase(RightDnRightVisionPara, "上相机右下角拍照位2", RightDnCamRightStaView); VisionStateUpCamLeftDn.SetCamLight(); VisionStateUpCamRightDn.SetCamLight(); VisionStateRightDnCamLeft.SetCamLight(); VisionStateRightDnCamRight.SetCamLight(); }
public void Init() { MyProjectPara = ProjectParaManager.Instance.GetProjectPara(0); LeftDnCamLeftVisionPara = MyProjectPara.GetVisionPara("左侧下相机左上角拍照位"); LeftDnCamRightVisionPara = MyProjectPara.GetVisionPara("左侧下相机右下角拍照位"); UpCamLeftUpVisionPara = MyProjectPara.GetVisionPara("上相机左上角拍照位1"); UpCamRightUpVisionPara = MyProjectPara.GetVisionPara("上相机右下角拍照位1"); LeftDnCamLeftView = DisplaySystem.GetViewControl("左侧下相机左上角拍照位"); LeftDnCamRightView = DisplaySystem.GetViewControl("左侧下相机右下角拍照位"); UpCamLeftUpView = DisplaySystem.GetViewControl("上相机左上角拍照位1"); UpCamRightUpCamView = DisplaySystem.GetViewControl("上相机右下角拍照位1"); VisionStateBaseUpCamLeftUp = new VisionStateBase(UpCamLeftUpVisionPara, "左侧下相机左上角拍照位", UpCamLeftUpView); VisionStateBaseUpCamRightUp = new VisionStateBase(UpCamRightUpVisionPara, "左侧下相机右下角拍照位", UpCamRightUpCamView); VisionStateDnLeftCamLeft = new VisionStateBase(LeftDnCamLeftVisionPara, "上相机左上角拍照位1", LeftDnCamLeftView); VisionStateDnLeftCamRight = new VisionStateBase(LeftDnCamRightVisionPara, "上相机右下角拍照位1", LeftDnCamRightView); VisionStateDnLeftCamLeft.SetCamLight(); VisionStateBaseUpCamRightUp.SetCamLight(); VisionStateDnLeftCamLeft.SetCamLight(); VisionStateDnLeftCamRight.SetCamLight(); }
private void FrmVisionProjectPara_Load(object sender, EventArgs e) { this.ProjectModelCbxCol.Items.Clear(); foreach (ProjectModelEnum item in Enum.GetValues(typeof(ProjectModelEnum))) { this.ProjectModelCbxCol.Items.Add(item); } this.ProjectModelCbxCol.ValueType = typeof(ProjectModelEnum); //this.ProjectModelCbxCol.DataPropertyName = "EventSeverity"; this.ProjectVisionEnumCbx.Items.Clear(); foreach (ProjectVisionEnum temp in Enum.GetValues(typeof(ProjectVisionEnum))) { this.ProjectVisionEnumCbx.Items.Add(temp); } this.ProjectVisionEnumCbx.ValueType = typeof(ProjectVisionEnum); //this.ProjectVisionEnumCbx.DataPropertyName = "EventSeverity"; this.CaliMatCbx.Items.Clear(); foreach (var temp in Enum.GetValues(typeof(CoordiCamHandEyeMatEnum))) { this.CaliMatCbx.Items.Add(temp); } this.CaliMatCbx.ValueType = typeof(CoordiCamHandEyeMatEnum); //this.CaliMatCbx.DataPropertyName = "EventSeverity"; this.LoclalModelCbxCol.Items.Clear(); foreach (LocalModelEnum item in Enum.GetValues(typeof(LocalModelEnum))) { this.LoclalModelCbxCol.Items.Add(item); } this.LoclalModelCbxCol.ValueType = typeof(LocalModelEnum); //this.LocalNoTbXCol.ValueType = typeof(LocalModelEnum); //this.LocalNoTbXCol.DataPropertyName = "EventSeverity"; UpDataProjectDgv(); TeachProjectPara = ProjectParaManager.Instance.ProjectParaList[TeachProjectItem]; TeachProjectMsg = ProjectParaManager.Instance.ProjectMsgList[TeachProjectItem]; UpDataVisionLocalParaDgv(); }
/// <summary> /// 扎针定位 /// </summary> /// <param name="PlcItem"></param> /// <param name="Obj"></param> public void DoProject(LD.Config.PlcDataItem PlcItem, Object Obj) { LD.Common.PlcDevice plcDevice = PlcItem.PlcDevice; if (plcDevice == LD.Common.PlcDevice.V_01_TriggerGrab) // { NowVisionProcess = new DoVisionProcess(); //起始信号清零 LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.V_01_TriggerGrab, 0); FileLib.Logger.Pop("接受到PLC信号,开始扎针对位", false, "运行日志"); short ClearValue = 1; object obj = new object(); while (true) { obj = LD.Logic.PlcHandle.Instance.ReadValue(LD.Common.PlcDevice.V_01_TriggerGrab); ClearValue = (short)obj; if (ClearValue == 0) { break; } else { System.Threading.Thread.Sleep(10); } } System.Threading.Thread.Sleep(1); //读取机台编号 int StageNum = (int)LD.Logic.PlcHandle.Instance.ReadValue(LD.Common.PlcDevice.ArtTestStageNumRead); FileLib.Logger.Pop(" 读取机台编号:" + StageNum.ToString(), false, "运行日志"); System.Threading.Thread.Sleep(1); //读取拍照位编号 short GrabNum = (short)LD.Logic.PlcHandle.Instance.ReadValue(LD.Common.PlcDevice.ArtTestGrabNum); System.Threading.Thread.Sleep(1); //获取视觉示教的定位参数 NowProjectPara = ProjectParaManager.Instance.GetProjectPara(StageNum); //获取当前拍照点的视觉坐标 NowVisionPara = NowProjectPara.GetVisionPara(GrabNum); NowVisionProcess.SetVisionPara(NowVisionPara); NowVisionProcess.Do(); if (GrabNum == 0) { FirstLocalResult = NowVisionProcess.MyLocalResult; FileLib.Logger.Pop(" 左边拍照定位完成,开始右边拍照定位:", false, "运行日志"); } else { SecondLocalResult = NowVisionProcess.MyLocalResult; //示教点到旋转中心的坐标 Point2Db TeachPt2d1 = new Point2Db(FirstLocalResult.TeachPosToRot.Col, FirstLocalResult.TeachPosToRot.Row); Point2Db TeachPt2d2 = new Point2Db(SecondLocalResult.TeachPosToRot.Col, SecondLocalResult.TeachPosToRot.Row); FileLib.Logger.Pop(" 示教产品到旋转中心的坐标(左右两点):" + TeachPt2d1.Col.ToString("f3") + " " + TeachPt2d1.Row.ToString("f3") + " " + TeachPt2d2.Col.ToString("f3") + " " + TeachPt2d2.Row.ToString("f3"), false, "运行日志"); //当前产品到旋转中心的坐标 Point2Db NowPosPt2d1 = new Point2Db(FirstLocalResult.PosToRot.Col, FirstLocalResult.PosToRot.Row); Point2Db NowPosPt2d2 = new Point2Db(SecondLocalResult.PosToRot.Col, SecondLocalResult.PosToRot.Row); FileLib.Logger.Pop(" 当前产品到旋转中心的坐标(左右两点):" + NowPosPt2d1.Col.ToString("f3") + " " + NowPosPt2d1.Row.ToString("f3") + " " + NowPosPt2d2.Col.ToString("f3") + " " + NowPosPt2d2.Row.ToString("f3"), false, "运行日志"); List <Point2Db> TeachPtList = new List <Point2Db>(); List <Point2Db> NowPtList = new List <Point2Db>(); //当前产品移动到产品示教时的位置,先计算出偏移矩阵 TeachPtList.Add(TeachPt2d1); TeachPtList.Add(TeachPt2d2); NowPtList.Add(NowPosPt2d1); NowPtList.Add(NowPosPt2d2); MyHomMat2D NowHomat = new MyHomMat2D(); bool IsTrue = false; MyVisionBase.VectorToRigidHomMat(NowPtList, TeachPtList, out NowHomat, out IsTrue); double AddX = 0, AddY = 0, AddTheta = 0; MyVisionBase.CalculateThreeTapePos(NowPosPt2d1, NowPosPt2d2, TeachPt2d1, TeachPt2d2, out AddX, out AddY, out AddTheta); FileLib.Logger.Pop(" 计算出的偏移补偿量:" + AddX.ToString("f3") + " " + AddY.ToString("f3") + " " + AddTheta.ToString("f3"), false, "运行日志"); ///再根据偏移矩阵计算出偏移量 double AddX1 = 0, AddY1 = 0, AddTheta1 = 0; MyVisionBase.HomMat2dToAffinePara(NowHomat, out AddTheta1, out AddY1, out AddX1); ViewControl view1 = DisplaySystem.GetViewControl(CameraTest.UpCam1); view1.SetString(500, 500, "red", " AddX: " + AddX.ToString("f4") + " mm "); view1.SetString(500, 600, "red", " AddY: " + AddY.ToString("f4") + " mm "); view1.SetString(500, 700, "red", " AddTheta: " + AddTheta.ToString("f4") + " 度 "); /// double addx0 = -AddX * 1000; double addy0 = AddY * 1000; double addtheta0 = AddTheta * 1000; int addx = (int)addx0; int addy = (int)addy0; int addtheta = (int)addtheta0; NowVisionPara = NowProjectPara.GetVisionPara(0); int offsetx = (int)(NowVisionPara.localPara.localSetting.Offset_x * 1000); int offsety = (int)(NowVisionPara.localPara.localSetting.Offset_y * 1000); int offsettheta = (int)(NowVisionPara.localPara.localSetting.Offset_theta * 1000); int newAddX = addx + offsetx; int NewAddY = addy + offsety; int NewAddTheta = -addtheta + offsettheta; if (StageNum == 0 || StageNum == 2)//左边两个平台X轴为正常方向,后面两个平台为反方向 { newAddX = addx + offsetx; } else { newAddX = -addx + offsetx; } LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.ArtTestAddX, newAddX); System.Threading.Thread.Sleep(5); LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.ArtTestAddY, NewAddY); System.Threading.Thread.Sleep(5); LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.ArtTestAddTheta, NewAddTheta);//图像坐标系为逆时针,机械坐标系为顺时针 System.Threading.Thread.Sleep(5); int ReadAddX = 0; int ReadAddY = 0; int ReadAddTheta = 0; object ObjRead = 0; int WriteCount = 0; while (true) { ObjRead = LD.Logic.PlcHandle.Instance.ReadValue(LD.Common.PlcDevice.ArtTestAddX); System.Threading.Thread.Sleep(5); ReadAddX = (int)ObjRead; ObjRead = LD.Logic.PlcHandle.Instance.ReadValue(LD.Common.PlcDevice.ArtTestAddY); System.Threading.Thread.Sleep(5); ReadAddY = (int)ObjRead; ObjRead = LD.Logic.PlcHandle.Instance.ReadValue(LD.Common.PlcDevice.ArtTestAddTheta); System.Threading.Thread.Sleep(5); ReadAddTheta = (int)ObjRead; if (ReadAddX == newAddX && ReadAddY == NewAddY && ReadAddTheta == NewAddTheta) { FileLib.Logger.Pop(" 补偿值成功写入", false, "运行日志"); break; } else { WriteCount++; if (WriteCount % 10 == 0) { LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.ArtTestAddX, newAddX); System.Threading.Thread.Sleep(5); LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.ArtTestAddY, NewAddY); System.Threading.Thread.Sleep(5); LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.ArtTestAddTheta, NewAddTheta);//图像坐标系为逆时针,机械坐标系为顺时针 System.Threading.Thread.Sleep(5); } if (WriteCount > 300) { break; } } } if (SecondLocalResult.IsLocalOk) { LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.ArtTestCamLocalResult, 1); //告诉PLC定位结果OK FileLib.Logger.Pop(" 告诉PLC补偿量已经发给PLC:", false, "运行日志"); } } } }
public void DoFOFProject1(LD.Config.PlcDataItem PlcItem, Object Obj) { LD.Common.PlcDevice plcDevice = PlcItem.PlcDevice; if (plcDevice == LD.Common.PlcDevice.V_02_TriggerGrab) { FileLib.Logger.Pop("接受到PLC信号,偏移检测", false, "FOF运行日志"); NowUpVisionProcess = new DoUpDnVisionProcess(); NowUpLocalRlt = new LocalResult(); NowDnLocalRlt = new LocalResult(); //起始信号清零 FileLib.Logger.Pop("启动信号清零", false, "FOF运行日志"); LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.V_02_TriggerGrab, 0); System.Threading.Thread.Sleep(1); short ClearValue = 1; object obj = new object(); FileLib.Logger.Pop("启动地址清零成功", false, "FOF运行日志"); //读取机台编号 4 代表FOF左侧FOF偏移检测 ,5代表FOF右侧偏移检测 int StageNum = (int)LD.Logic.PlcHandle.Instance.ReadValue(LD.Common.PlcDevice.ArtTestStageNumRead); FileLib.Logger.Pop(" 读取机台编号:" + StageNum.ToString(), false, "FOF运行日志"); System.Threading.Thread.Sleep(1); //获取视觉示教的定位参数 NowProjectPara = ProjectParaManager.Instance.GetProjectPara(StageNum); //获取当前拍照点的视觉坐标 double OffsetX = 0; double OffsetY = 0; try { FileLib.Logger.Pop("开始FOF偏移检测上相机定位", false, "FOF运行日志"); NowVisionPara = NowProjectPara.GetVisionPara(0); NowUpVisionProcess.SetVisionPara(NowVisionPara); NowUpVisionProcess.Do(); NowUpLocalRlt = NowUpVisionProcess.MyLocalResult; BlobLocalRlt FofRlt = (BlobLocalRlt)NowUpLocalRlt; double x = FofRlt.ListWid[0] * NowVisionPara.localPara.Blobs.PixelSize; double y = FofRlt.ListHei[1] * NowVisionPara.localPara.Blobs.PixelSize; OffsetX = x + NowVisionPara.localPara.localSetting.Offset_x; OffsetY = y + NowVisionPara.localPara.localSetting.Offset_y; FileLib.Logger.Pop("偏移量: " + "OffsetX: " + OffsetX.ToString("f4") + " " + "OffsetY: " + OffsetY.ToString("f4"), false, "FOF运行日志"); } catch (Exception e0) { Logger.PopError1(e0, false, "视觉错误日志"); OffsetX = 999999; OffsetY = 999999; } ViewControl view1 = DisplaySystem.GetViewControl(CameraTest.UpCam2); view1.SetString(500, 500, "red", "OffsetX: " + OffsetX.ToString("f4") + " mm"); view1.SetString(500, 600, "red", "OffsetY: " + OffsetY.ToString("f4") + " mm"); if (Math.Abs(OffsetX) < NowVisionPara.localPara.localSetting.Offset_x_range && Math.Abs(OffsetY) < NowVisionPara.localPara.localSetting.Offset_y_range) { LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.FOF_inspect_result, 1); //检测结果Ok FileLib.Logger.Pop("检测结果写给Plc(FOF_inspect_result):OK", false, "FOF运行日志"); } else { LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.FOF_inspect_result, 2); //检测结果NG FileLib.Logger.Pop("检测结果写给Plc(FOF_inspect_result):NG", false, "FOF运行日志"); } FileLib.Logger.Pop("循环读取启动地址,保证清零成功", false, "FOF运行日志"); int ReadCount = 1; while (true) { obj = LD.Logic.PlcHandle.Instance.ReadValue(LD.Common.PlcDevice.V_02_TriggerGrab); ClearValue = (short)obj; if (ClearValue == 0) { break; } else { System.Threading.Thread.Sleep(10); if (ReadCount % 10 == 0) { FileLib.Logger.Pop("重新执行一次清零", false, "FOF运行日志"); ReadCount = 1; LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.V_02_TriggerGrab, 0); } if (ReadCount > 100) { FileLib.Logger.Pop("清零次数超过10,清零失败", false, "FOF运行日志"); } } ReadCount++; } FileLib.Logger.Pop("将偏移量写给PLC", false, "FOF运行日志"); LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.FOF_offset_x, (int)(OffsetX * 1000)); LD.Logic.PlcHandle.Instance.WriteValue(LD.Common.PlcDevice.FOF_offset_y, (int)(OffsetY * 1000)); FileLib.Logger.Pop("偏移量写给PLC完成", false, "FOF运行日志"); FileLib.Logger.Pop("。", false, "FOF运行日志"); FileLib.Logger.Pop("。", false, "FOF运行日志"); FileLib.Logger.Pop("。", false, "FOF运行日志"); } }
private void ProjectDgv_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.RowIndex >= ProjectParaManager.Instance.ProjectMsgList.Count()) { return; } if (ProjectParaManager.Instance.ProjectMsgList == null) { return; } if (ProjectParaManager.Instance.ProjectMsgList.Count() == 0) { return; } if (e.ColumnIndex == 2)//视觉项目类型 { ProjectParaManager.Instance.ProjectMsgList[e.RowIndex].ProjectModel = (ProjectModelEnum)ProjectDgv.Rows[e.RowIndex].Cells[2].Value; } if (e.ColumnIndex == 3) //参数清除 { DialogResult Rlt = MessageBox.Show("是否清除参数", "工程参数清除", MessageBoxButtons.YesNo); if (Rlt == DialogResult.No) { return; } ProjectModelEnum obj0 = (ProjectModelEnum)ProjectDgv.Rows[e.RowIndex].Cells[e.ColumnIndex - 1].Value; if (Rlt == DialogResult.Yes) { if (e.RowIndex < ProjectParaManager.Instance.ProjectMsgList.Count()) { ProjectParaManager.Instance.ProjectParaList[e.RowIndex] = new ProjectPara(obj0); } else { ProjectParaManager.Instance.ProjectParaList.Add(new ProjectPara(obj0)); } } } if (e.ColumnIndex == 4)//工程参数示教 { if (ProjectParaManager.Instance.ProjectParaList.Count == 0) { return; } if (ProjectParaManager.Instance.ProjectParaList.Count > e.RowIndex) { TeachProjectPara = ProjectParaManager.Instance.ProjectParaList[e.RowIndex]; UpDataVisionLocalParaDgv(); } } if (e.ColumnIndex == 5)//参数保存 { DialogResult Rlt = MessageBox.Show("是否保存参数", "工程参数保存", MessageBoxButtons.YesNo); if (Rlt == DialogResult.No) { return; } ProjectParaManager.Instance.ProjectMsgList[e.RowIndex].ProjectDescribe = ProjectDgv.Rows[e.RowIndex].Cells[1].Value.ToString(); ProjectParaManager.Instance.Save(); } if (e.ColumnIndex == 6)//参数删除 { ProjectParaManager.Instance.ProjectParaList.RemoveAt(e.RowIndex); ProjectParaManager.Instance.ProjectMsgList.RemoveAt(e.RowIndex); UpDataProjectDgv(); } TeachProjectItem = e.RowIndex; if (e.RowIndex < ProjectParaManager.Instance.ProjectParaList.Count) { TeachProjectMsg = ProjectParaManager.Instance.ProjectMsgList[e.RowIndex]; TeachProjectPara = ProjectParaManager.Instance.ProjectParaList[e.RowIndex]; UpDataVisionLocalParaDgv(); } }