예제 #1
0
파일: FrmCameraManager.cs 프로젝트: Gz1d/Gz
 private void CamParaDgv_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     try {
         if (e.RowIndex < 0)
         {
             return;
         }
         if (this.CamParaDgv.Columns[e.ColumnIndex].Name.Equals("isOpen"))
         {
             if (e.RowIndex < CameraParaManager.Instance.CameraParaList.Count())
             {
                 CameraPara item = CameraParaManager.Instance.CameraParaList[e.RowIndex];
                 if (item == null)
                 {
                     e.Value = this.imageList1.Images[3];
                 }
                 else if (item.IsOpen)
                 {
                     e.Value = (item.IsActive == true) ? this.imageList1.Images[2] : this.imageList1.Images[2];
                 }
                 else
                 {
                     e.Value = this.imageList1.Images[1];
                 }
             }
         }
     }
     catch
     { }
 }
예제 #2
0
파일: FrmCameraManager.cs 프로젝트: Gz1d/Gz
        private void CamParaDgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try{
                if (e.RowIndex >= 0)
                {
                    //当前行对应的相机参数
                    CameraPara CurCamPara = (CameraPara)this.CamParaDgv.CurrentRow.DataBoundItem;
                    if (CurCamPara == null)
                    {
                        return;
                    }
                    switch (CamParaDgv.Columns[e.ColumnIndex].Name)
                    {
                    case "DeleteBtnDgvCol":
                        if (MessageBox.Show("是否删除该项设备?    ", "删除提示", MessageBoxButtons.YesNo,
                                            MessageBoxIcon.Question) != DialogResult.Yes)
                        {
                            return;
                        }
                        CameraParaManager.Instance.CameraParaList.Remove(CurCamPara);
                        break;

                    case "OpenCamBtnDgvCol":
                        CameraPara camParaI;
                        for (int i = 0; i < CameraParaManager.Instance.CameraParaList.Count() - 1; i++)
                        {
                            camParaI = CameraParaManager.Instance.CameraParaList[i];
                            if (CurCamPara.CameraName == camParaI.CameraName)
                            {
                                MessageBox.Show("相机已经示教,请重新选择相机");
                                break;
                            }
                        }
                        CameraCtrl.Instance.Init();
                        break;

                    case "GrabImgDgvCol":
                        ImgOut.Dispose();
                        CameraCtrl.Instance.GrabImg(CurCamPara.CameraName, out ImgOut);
                        view.ResetView();
                        view.AddViewImage(ImgOut);
                        //view.Refresh();
                        view.Repaint();
                        break;
                    }
                    this.CamParaDgv.Refresh();
                }
            }
            catch
            { }
        }
예제 #3
0
파일: CameraBase.cs 프로젝트: Gz1d/Gz
 public void SetCamPara(CameraPara camParaIn)
 {
     this.myCamPara = camParaIn;
 }