Sfoglia il codice sorgente

Merge branch 'dev' of http://192.168.1.123:10080/gaoshipeng/OTS2_0 into dev

CXS 4 anni fa
parent
commit
595b527391

+ 5 - 5
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/CreateRectangle.cs

@@ -914,11 +914,11 @@ namespace OTSMeasureApp
         X = 0,
         Y = 1
     }
-    public enum IndexNum
-    {
-        First = 0,
-        Second = 1
-    }
+    //public enum IndexNum
+    //{
+    //    First = 0,
+    //    Second = 1
+    //}
     public enum CreateRectangleType
     {
         //样品台-圆形

+ 1 - 1
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceGraphicsPanelFun.cs

@@ -1649,7 +1649,7 @@ namespace OTSMeasureApp
                 if (item.Region.Contains(mPoint))
                 {
                     //鼠标在样品台中移动获取坐标
-                    Point mousePoint = OTSSamplespaceGraphicsPanelFun.GetMouseLocationInRectangleGDIObject(mPoint, m_RectangleGDIObjects[(int)IndexNum.First], m_OTSSampleStageData, IsWidth, m_RectangleGDIObjects[(int)IndexNum.First].Region.Width, m_RectangleGDIObjects[(int)IndexNum.First].Region.Height);
+                    Point mousePoint = OTSSamplespaceGraphicsPanelFun.GetMouseLocationInRectangleGDIObject(mPoint, m_RectangleGDIObjects[0], m_OTSSampleStageData, IsWidth, m_RectangleGDIObjects[0].Region.Width, m_RectangleGDIObjects[0].Region.Height);
 
                     PointF SEMPoint = m_MeasureAppForm.m_ProjParam.ChangeOTSToSemCoord(mousePoint);
                     //将微米转换为毫米

+ 50 - 50
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs

@@ -311,7 +311,7 @@ namespace OTSMeasureApp
                 {
                     if (m_SingleGDIObjects.Count > 0)
                     {
-                        singleSampleName = m_SingleGDIObjects[(int)IndexNum.First].SampleName;
+                        singleSampleName = m_SingleGDIObjects[0].SampleName;
                     }
                 }
                 //判断当前帧图所在样品的样品名称与新样品名称是否相同
@@ -329,7 +329,7 @@ namespace OTSMeasureApp
                 {
                     if (m_SingleGDIObjects.Count > 0)
                     {
-                        if (m_SingleGDIObjects[(int)IndexNum.First].SampleName != sNewWSampleName)
+                        if (m_SingleGDIObjects[0].SampleName != sNewWSampleName)
                         {
                             //先清空帧图信息
                             ClearImageAndSingleGDIObjects();
@@ -500,7 +500,7 @@ namespace OTSMeasureApp
                         if (item.SampleName == sampleName)
                         {
                             item.IsWorkSample = true;
-                            if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(item, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[(int)IndexNum.First], IsWidth, Width, Height, m_WDomain))
+                            if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(item, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain))
                             {
                                 //保存原位置
                                 Rectangle rectPara = item.Region;
@@ -544,7 +544,7 @@ namespace OTSMeasureApp
                 {
                     if (item.IsWorkSample)
                     {
-                        if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(item, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[(int)IndexNum.First], IsWidth, Width, Height, m_WDomain))
+                        if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(item, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain))
                         {
                             //保存原位置
                             Rectangle rectPara = item.Region;
@@ -609,7 +609,7 @@ namespace OTSMeasureApp
                 if (CStageManage.AddSample(SMeasurePara.sHoleName, SMeasurePara.sSampleName, m_SampleGDIObject, this, m_GlobalZoomNum))
                 {
                     //设置新添加样品测量的位置
-                    if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(m_MeasureGDIObjects[m_MeasureGDIObjects.Count - 1], m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[(int)IndexNum.First], IsWidth, Width, Height, m_WDomain))
+                    if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(m_MeasureGDIObjects[m_MeasureGDIObjects.Count - 1], m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain))
                     {
                         CStageManage.SetWorkSampleAndWorkMeasure(SMeasurePara.sSampleName);
                         //清除帧图信息
@@ -783,7 +783,7 @@ namespace OTSMeasureApp
                 CreateBourary.Shape = StageShape;
                 m_RectangleGDIObjects.Add(CreateBourary);
                 //绘制后的样品台中心位置
-                Point m_Region = OTSSamplespaceGraphicsPanelFun.GetCenterPoint(m_RectangleGDIObjects[(int)IndexNum.First].Region);
+                Point m_Region = OTSSamplespaceGraphicsPanelFun.GetCenterPoint(m_RectangleGDIObjects[0].Region);
                 //获取绘制后的样品台中心位置
                 if (m_RegionStartCenterPoint.X != m_Region.X || m_RegionStartCenterPoint.Y != m_Region.Y)
                 {
@@ -1036,7 +1036,7 @@ namespace OTSMeasureApp
                                     m_DrawMeasureGDIObjects.Clear();
                                     m_DrawPolygonFinishGDIObjects.Clear();
                                 }
-                                if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(m_MeasureGDIObjects[m_MeasureGDIObjects.Count - 1], m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[(int)IndexNum.First], IsWidth, Width, Height, m_WDomain))
+                                if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(m_MeasureGDIObjects[m_MeasureGDIObjects.Count - 1], m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain))
                                 {
                                     m_MeasureAppForm.m_MessageStates = (int)MessageState.StartMeasure;
                                     CMeasureWrapperThread.DoRunType = (int)MSR_THREAD_RunSTATUS.RUNMEASURE;
@@ -1083,7 +1083,7 @@ namespace OTSMeasureApp
                 else
                 {
                     //在样品台内部缩放
-                    if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(new Rectangle(this.m_MouseDownPoint, new Size(2, 2)), m_RectangleGDIObjects[(int)IndexNum.First].Region, m_DrawMeasureType))
+                    if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(new Rectangle(this.m_MouseDownPoint, new Size(2, 2)), m_RectangleGDIObjects[0].Region, m_DrawMeasureType))
                     {
                         m_IsDrawMeasure = true;
                     }
@@ -1173,7 +1173,7 @@ namespace OTSMeasureApp
                                         isSelMeasure = true;
                                         Rectangle rect = new Rectangle(e.Location, new Size(WH, WH));
                                         int CheckShape = (int)CreateRectangleType.CirCle;
-                                        if (m_MeasureGDIObjects[(int)IndexNum.First].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
+                                        if (m_MeasureGDIObjects[0].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
                                         {
                                             CheckShape = (int)CreateRectangleType.SampleBackGround_Rectangle;
                                         }
@@ -1251,7 +1251,7 @@ namespace OTSMeasureApp
                             Rectangle rect = new Rectangle(e.Location, new Size(WH, WH));
                             //判断样品形状
                             int CheckShape = (int)CreateRectangleType.CirCle;
-                            if (m_MeasureGDIObjects[(int)IndexNum.First].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
+                            if (m_MeasureGDIObjects[0].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
                             {
                                 CheckShape = (int)CreateRectangleType.SampleBackGround_Rectangle;
                             }
@@ -1711,7 +1711,7 @@ namespace OTSMeasureApp
                                 break;
                         }
                         //在样品台内部缩放
-                        if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectangle, m_RectangleGDIObjects[(int)IndexNum.First].Region, m_DrawMeasureType))
+                        if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectangle, m_RectangleGDIObjects[0].Region, m_DrawMeasureType))
                         {
                             //移动鼠标绘制测量区域
                             //以中心绘制测量区域方法
@@ -1769,12 +1769,12 @@ namespace OTSMeasureApp
                                                         rectTemp.X = item.Region.Left + e.X - item.DraggingPoint.X;
                                                         rectTemp.Y = item.Region.Top + e.Y - item.DraggingPoint.Y;
                                                         int CheckShape = (int)CreateRectangleType.CirCle;
-                                                        if (m_RectangleGDIObjects[(int)IndexNum.First].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
+                                                        if (m_RectangleGDIObjects[0].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
                                                         {
                                                             CheckShape = (int)CreateRectangleType.SampleBackGround_Rectangle;
                                                         }
                                                         //判断样品是否超越样品台
-                                                        if (!OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectTemp, m_RectangleGDIObjects[(int)IndexNum.First].Region, CheckShape))
+                                                        if (!OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectTemp, m_RectangleGDIObjects[0].Region, CheckShape))
                                                         {
                                                             return;
                                                         }
@@ -1785,17 +1785,17 @@ namespace OTSMeasureApp
                                                             //判断多边形是否超越样品台
                                                             rectMeasureTemp.X = rectMeasureTemp.Left + e.X - measureItem.DraggingPoint.X;
                                                             rectMeasureTemp.Y = rectMeasureTemp.Top + e.Y - measureItem.DraggingPoint.Y;
-                                                            if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectMeasureTemp, m_RectangleGDIObjects[(int)IndexNum.First].Region, CheckShape))
+                                                            if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectMeasureTemp, m_RectangleGDIObjects[0].Region, CheckShape))
                                                             {
                                                                 Rectangle rectSampleTemp = item.Region;
                                                                 rectSampleTemp.X = item.Region.Left + e.X - item.DraggingPoint.X;
                                                                 rectSampleTemp.Y = item.Region.Top + e.Y - item.DraggingPoint.Y;
-                                                                if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectSampleTemp, m_RectangleGDIObjects[(int)IndexNum.First].Region, CheckShape))
+                                                                if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectSampleTemp, m_RectangleGDIObjects[0].Region, CheckShape))
                                                                 {
                                                                     MouseMovePolygonMeasureFucntion(measureItem, e);
                                                                     OTSSamplespaceGraphicsPanelFun.GetMouseMoveLocation(item, e);
                                                                     //计算两个点之间的距离 移动样品台后与绘制样品台时的位置
-                                                                    m_DifferentPoint = OTSSamplespaceGraphicsPanelFun.StartToEndPointDist(m_RectangleGDIObjects[(int)IndexNum.First], m_RegionStartCenterPoint);
+                                                                    m_DifferentPoint = OTSSamplespaceGraphicsPanelFun.StartToEndPointDist(m_RectangleGDIObjects[0], m_RegionStartCenterPoint);
                                                                     isChange = true;
                                                                 }
                                                             }
@@ -1811,27 +1811,27 @@ namespace OTSMeasureApp
                                                         rectTemp.X = item.Region.Left + e.X - item.DraggingPoint.X;
                                                         rectTemp.Y = item.Region.Top + e.Y - item.DraggingPoint.Y;
                                                         int CheckShape = (int)CreateRectangleType.CirCle;
-                                                        if (m_RectangleGDIObjects[(int)IndexNum.First].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
+                                                        if (m_RectangleGDIObjects[0].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
                                                         {
                                                             CheckShape = (int)CreateRectangleType.SampleBackGround_Rectangle;
                                                         }
                                                         //判断样品是否超越样品台
-                                                        if (!OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectTemp, m_RectangleGDIObjects[(int)IndexNum.First].Region, CheckShape))
+                                                        if (!OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectTemp, m_RectangleGDIObjects[0].Region, CheckShape))
                                                         {
                                                             return;
                                                         }
                                                         //判断测量区域是否超越样品台
-                                                        if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectMeasureTemp, m_RectangleGDIObjects[(int)IndexNum.First].Region, CheckShape))
+                                                        if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectMeasureTemp, m_RectangleGDIObjects[0].Region, CheckShape))
                                                         {
                                                             Rectangle rectSampleTemp = item.Region;
                                                             rectSampleTemp.X = item.Region.Left + e.X - item.DraggingPoint.X;
                                                             rectSampleTemp.Y = item.Region.Top + e.Y - item.DraggingPoint.Y;
-                                                            if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectSampleTemp, m_RectangleGDIObjects[(int)IndexNum.First].Region, CheckShape))
+                                                            if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectSampleTemp, m_RectangleGDIObjects[0].Region, CheckShape))
                                                             {
                                                                 MouseMoveMeasureFucntion(measureItem, e);
                                                                 OTSSamplespaceGraphicsPanelFun.GetMouseMoveLocation(item, e);
                                                                 //计算两个点之间的距离 移动样品台后与绘制样品台时的位置
-                                                                m_DifferentPoint = OTSSamplespaceGraphicsPanelFun.StartToEndPointDist(m_RectangleGDIObjects[(int)IndexNum.First], m_RegionStartCenterPoint);
+                                                                m_DifferentPoint = OTSSamplespaceGraphicsPanelFun.StartToEndPointDist(m_RectangleGDIObjects[0], m_RegionStartCenterPoint);
                                                                 isChange = true;
                                                             }
                                                         }
@@ -1908,7 +1908,7 @@ namespace OTSMeasureApp
                                                             selPolygonPointRect.X = (int)m_SelPolygonPoint.X + e.X - item.DraggingPoint.X;
                                                             selPolygonPointRect.Y = (int)m_SelPolygonPoint.Y + e.Y - item.DraggingPoint.Y;
                                                             //判断样品是否超越样品台
-                                                            if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(selPolygonPointRect, m_RectangleGDIObjects[(int)IndexNum.First].Region, CheckShape))
+                                                            if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(selPolygonPointRect, m_RectangleGDIObjects[0].Region, CheckShape))
                                                             {
                                                                 if (i == 0 || i == item.PolygonPointRegionF.Count - 1)
                                                                 {
@@ -1960,7 +1960,7 @@ namespace OTSMeasureApp
                                             rectTemp = new Rectangle(xy1.X - r, xy1.Y - r, width, width);
 
                                             //在样品台内部缩放
-                                            if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectTemp, m_RectangleGDIObjects[(int)IndexNum.First].Region, CheckShape))
+                                            if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectTemp, m_RectangleGDIObjects[0].Region, CheckShape))
                                             {
                                                 #region 需抽出作为公共方法
                                                 int xMove = rectTemp.X - item.Region.X;
@@ -2052,12 +2052,12 @@ namespace OTSMeasureApp
                     if (m_SingleGDIObjects.Count > 0)
                     {
                         MouseMoveSingleFucntion(m_SingleGDIObjects, e);
-                        string sampleName = m_SingleGDIObjects[(int)IndexNum.First].SampleName;
+                        string sampleName = m_SingleGDIObjects[0].SampleName;
                     }
                     //样品孔BSE图片
                     MouseMoveSingleFucntion(m_ImageGDIObjects, e);
                     //计算两个点之间的距离 移动样品台后与绘制样品台时的位置
-                    m_DifferentPoint = OTSSamplespaceGraphicsPanelFun.StartToEndPointDist(m_RectangleGDIObjects[(int)IndexNum.First], m_RegionStartCenterPoint);
+                    m_DifferentPoint = OTSSamplespaceGraphicsPanelFun.StartToEndPointDist(m_RectangleGDIObjects[0], m_RegionStartCenterPoint);
 
                 }
 
@@ -2116,7 +2116,7 @@ namespace OTSMeasureApp
                                     }
                                 }
                                 m_MeasureGDIObjects[i] = item;
-                                if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(item, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[(int)IndexNum.First], IsWidth, Width, Height, m_WDomain))
+                                if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(item, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain))
                                 {
                                     m_MeasureAppForm.m_MessageStates = (int)MessageState.StartMeasure;
                                     CMeasureWrapperThread.DoRunType = (int)MSR_THREAD_RunSTATUS.RUNMEASURE;
@@ -2183,7 +2183,7 @@ namespace OTSMeasureApp
                             }
                             #endregion
                             //获取修改后的测量区域的位置与尺寸
-                            if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(measureItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[(int)IndexNum.First], IsWidth, Width, Height, m_WDomain))
+                            if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(measureItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain))
                             {
                                 //设置图形位置与大小
                                 measureItem.Region = rectPara;
@@ -2289,7 +2289,7 @@ namespace OTSMeasureApp
                                             rectParaF.Height = measureItem.RegionF.Height;
                                             //判断移动到其他样品孔后、当前测量区域是否超越样品台边缘
                                             int CheckShape = measureItem.Shape;
-                                            if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectPara, m_RectangleGDIObjects[(int)IndexNum.First].Region, CheckShape))
+                                            if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectPara, m_RectangleGDIObjects[0].Region, CheckShape))
                                             {
                                                 measureItem.Region = rectPara;
                                                 measureItem.RegionF = rectParaF;
@@ -2301,7 +2301,7 @@ namespace OTSMeasureApp
                                         measureItem.SampleCenterDifferCenterPoint = OTSSamplespaceGraphicsPanelFun.GetSampleCenterDifferCenterPoint(rectPara, measureItem.Region);
 
                                         //获取修改后的测量区域的位置与尺寸
-                                        if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(measureItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[(int)IndexNum.First], IsWidth, Width, Height, m_WDomain))
+                                        if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(measureItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain))
                                         {
                                             //设置测量区域信息
                                             measureItem.SampleName = item.SampleName;
@@ -2353,7 +2353,7 @@ namespace OTSMeasureApp
                     {
                         if (measureItem.IsWorkSample)
                         {
-                            if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(measureItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[(int)IndexNum.First], IsWidth, Width, Height, m_WDomain))
+                            if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(measureItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain))
                             {
                                 if (measureItem.IsSingle)
                                 {
@@ -2497,7 +2497,7 @@ namespace OTSMeasureApp
             //计算两个点之间的距离 移动样品台后与绘制样品台时的位置
             if (m_RectangleGDIObjects.Count > 0)
             {
-                m_DifferentPoint = OTSSamplespaceGraphicsPanelFun.StartToEndPointDist(m_RectangleGDIObjects[(int)IndexNum.First], m_RegionStartCenterPoint);
+                m_DifferentPoint = OTSSamplespaceGraphicsPanelFun.StartToEndPointDist(m_RectangleGDIObjects[0], m_RegionStartCenterPoint);
             }
             m_IsCtrl = false;
             m_IsAlt = false;
@@ -2644,23 +2644,23 @@ namespace OTSMeasureApp
                     OTSSamplespaceGraphicsPanelFun.RecoverInitialPosition(m_ALLSingleGDIObjects, m_GlobalZoomNum);
                     OTSSamplespaceGraphicsPanelFun.RecoverInitialPosition(m_ImageGDIObjects, m_GlobalZoomNum);
                     //样品
-                    OTSSamplespaceGraphicsPanelFun.MouseWheelFunction(m_SampleGDIObjects, m_RectangleGDIObjects[(int)IndexNum.First], m_GlobalZoomNum);
+                    OTSSamplespaceGraphicsPanelFun.MouseWheelFunction(m_SampleGDIObjects, m_RectangleGDIObjects[0], m_GlobalZoomNum);
                     //样品孔
-                    OTSSamplespaceGraphicsPanelFun.MouseWheelFunction(m_SampleHoleGDIObjects, m_RectangleGDIObjects[(int)IndexNum.First], m_GlobalZoomNum);
+                    OTSSamplespaceGraphicsPanelFun.MouseWheelFunction(m_SampleHoleGDIObjects, m_RectangleGDIObjects[0], m_GlobalZoomNum);
                     //标样
-                    OTSSamplespaceGraphicsPanelFun.MouseWheelFunction(m_SpecimenGDIObjects, m_RectangleGDIObjects[(int)IndexNum.First], m_GlobalZoomNum);
+                    OTSSamplespaceGraphicsPanelFun.MouseWheelFunction(m_SpecimenGDIObjects, m_RectangleGDIObjects[0], m_GlobalZoomNum);
                     //测量区域
-                    OTSSamplespaceGraphicsPanelFun.MouseWheelFunction(m_MeasureGDIObjects, m_RectangleGDIObjects[(int)IndexNum.First], m_GlobalZoomNum);
+                    OTSSamplespaceGraphicsPanelFun.MouseWheelFunction(m_MeasureGDIObjects, m_RectangleGDIObjects[0], m_GlobalZoomNum);
                     //文字
-                    OTSSamplespaceGraphicsPanelFun.MouseWheelFunction(m_ContentGDIObjects, m_RectangleGDIObjects[(int)IndexNum.First], m_GlobalZoomNum);
+                    OTSSamplespaceGraphicsPanelFun.MouseWheelFunction(m_ContentGDIObjects, m_RectangleGDIObjects[0], m_GlobalZoomNum);
                     //样品台
-                    OTSSamplespaceGraphicsPanelFun.MouseWheelFunction(m_RectangleGDIObjects, m_RectangleGDIObjects[(int)IndexNum.First], m_GlobalZoomNum);
+                    OTSSamplespaceGraphicsPanelFun.MouseWheelFunction(m_RectangleGDIObjects, m_RectangleGDIObjects[0], m_GlobalZoomNum);
 
                     if (m_GlobalZoomNum == 1)
                     {
                         // 将绘制的样品台信息 按屏幕中心移动
                         //获取当前样品台中心点
-                        Point samplePoint = OTSSamplespaceGraphicsPanelFun.GetCenterPoint(m_RectangleGDIObjects[(int)IndexNum.First].Region);
+                        Point samplePoint = OTSSamplespaceGraphicsPanelFun.GetCenterPoint(m_RectangleGDIObjects[0].Region);
 
                         //获取当前工作区域中心点
                         Point workAreaPoint = OTSSamplespaceGraphicsPanelFun.GetCenterPoint(this.ClientRectangle);
@@ -2774,11 +2774,11 @@ namespace OTSMeasureApp
             rectTemp.X = item.Region.Left + e.X - item.DraggingPoint.X;
             rectTemp.Y = item.Region.Top + e.Y - item.DraggingPoint.Y;
             int CheckShape = (int)CreateRectangleType.CirCle;
-            if (m_RectangleGDIObjects[(int)IndexNum.First].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
+            if (m_RectangleGDIObjects[0].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
             {
                 CheckShape = (int)CreateRectangleType.SampleBackGround_Rectangle;
             }
-            if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectTemp, m_RectangleGDIObjects[(int)IndexNum.First].Region, CheckShape))
+            if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectTemp, m_RectangleGDIObjects[0].Region, CheckShape))
             {
                 #region 需抽出作为公共方法
                 int xMove = rectTemp.X - item.Region.X;
@@ -2811,7 +2811,7 @@ namespace OTSMeasureApp
             {
                 //判断样品台形状
                 int CheckShape = (int)CreateRectangleType.CirCle;
-                if (m_RectangleGDIObjects[(int)IndexNum.First].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
+                if (m_RectangleGDIObjects[0].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
                 {
                     CheckShape = (int)CreateRectangleType.SampleBackGround_Rectangle;
                 }
@@ -2821,7 +2821,7 @@ namespace OTSMeasureApp
                 //判断多边形是否超越样品台
                 rectMeasureTemp.X = rectMeasureTemp.Left + e.X - item.DraggingPoint.X;
                 rectMeasureTemp.Y = rectMeasureTemp.Top + e.Y - item.DraggingPoint.Y;
-                if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectMeasureTemp, m_RectangleGDIObjects[(int)IndexNum.First].Region, CheckShape))
+                if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectMeasureTemp, m_RectangleGDIObjects[0].Region, CheckShape))
                 {
                     int polygonPointCount = item.DrawPolygonPointRegionF.Count;
                     if (polygonPointCount > 0)
@@ -2888,11 +2888,11 @@ namespace OTSMeasureApp
             rectTemp.Width = 2;
             rectTemp.Height = 2;
             int CheckShape = (int)CreateRectangleType.CirCle;
-            if (m_RectangleGDIObjects[(int)IndexNum.First].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
+            if (m_RectangleGDIObjects[0].Shape == (int)CreateRectangleType.SampleBackGround_Rectangle)
             {
                 CheckShape = (int)CreateRectangleType.SampleBackGround_Rectangle;
             }
-            if (!OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectTemp, m_RectangleGDIObjects[(int)IndexNum.First].Region, CheckShape))
+            if (!OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(rectTemp, m_RectangleGDIObjects[0].Region, CheckShape))
             {
                 return false;
             }
@@ -3401,7 +3401,7 @@ namespace OTSMeasureApp
                                     //多边形测量区域完成标识
                                     m_DrawPolygonFinishGDIObjects = new List<ARectangleGDIObject>();
                                     //获取样品台 中心点
-                                    PointF RectanglePointCenter = OTSSamplespaceGraphicsPanelFun.GetCenterPointF(m_RectangleGDIObjects[(int)IndexNum.First].RegionF);
+                                    PointF RectanglePointCenter = OTSSamplespaceGraphicsPanelFun.GetCenterPointF(m_RectangleGDIObjects[0].RegionF);
                                     //获取样品台中心点
                                     int w = (IsWidth == 0 ? m_DefaultW : m_DefaultH);
                                     float CenterX = OTSSamplespaceGraphicsPanelFun.PixelConvertToMicron((int)RectanglePointCenter.X, m_WDomain, w);
@@ -3978,7 +3978,7 @@ namespace OTSMeasureApp
                     int w = (int)OTSSamplespaceGraphicsPanelFun.MillimetersToPixelsWidth(m_WDomain, Convert.ToDouble(OTSLocation.X), IsWidth, m_DefaultW, m_DefaultH);
                     int h = (int)OTSSamplespaceGraphicsPanelFun.MillimetersToPixelsWidth(m_WDomain, Convert.ToDouble(OTSLocation.Y), IsWidth, m_DefaultW, m_DefaultH);
                     //样品台中心点
-                    Point m_StageCenterPoint = OTSSamplespaceGraphicsPanelFun.GetCenterPoint(m_RectangleGDIObjects[(int)IndexNum.First]);
+                    Point m_StageCenterPoint = OTSSamplespaceGraphicsPanelFun.GetCenterPoint(m_RectangleGDIObjects[0]);
                     Point moveToSEMLocation = new Point(w, h);
                     //根据鼠标右键点击的位置 重新绘制帧图
                     if (m_MeasureGDIObjects != null)
@@ -4003,7 +4003,7 @@ namespace OTSMeasureApp
                                             //根据鼠标右键点击的位置 重新绘制区域路径
                                             OTSSamplespaceGraphicsPanelFun.NewLocationDrawMeasureInfo(this, m_RectangleGDIObjects, m_OTSSampleStageData, IsWidth, moveToSEMLocation, m_MeasurePathGDIObjects, m_GlobalZoomNum);
                                             //设置当前测量区域的位置
-                                            bool result = OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(MeasureItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[(int)IndexNum.First], IsWidth, Width, Height, m_WDomain);
+                                            bool result = OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(MeasureItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain);
                                             //删除已存在的帧图信息  在重新添加当前操作的帧图信息
                                             OTSSamplespaceGraphicsPanelFun.DeleteALLSingleInfo(m_ALLSingleGDIObjects, MeasureItem.SampleName);
                                             OTSSamplespaceGraphicsPanelFun.AddALLSingleInfo(m_ALLSingleGDIObjects, m_SingleGDIObjects, MeasureItem.SampleName);
@@ -4507,7 +4507,7 @@ namespace OTSMeasureApp
                         {
                             if (sampleHoleItem.Name == sampleHoleInfo.sSHoleName)
                             {
-                                SampleHolePara sampleHolePara = OTSSamplespaceGraphicsPanelFun.GetSampleHoleRect(sampleHoleItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[(int)IndexNum.First], IsWidth, Width, Height, m_WDomain);
+                                SampleHolePara sampleHolePara = OTSSamplespaceGraphicsPanelFun.GetSampleHoleRect(sampleHoleItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain);
                                 iShape = (DOMAIN_SHAPE)sampleHolePara.iShape;
                                 Srect = sampleHolePara.SampleHoleRect;
                                 //设置测量区域形状
@@ -4530,7 +4530,7 @@ namespace OTSMeasureApp
                         {
                             measureIndex++;
 
-                            SampleMeasurePara sampleMeasure = OTSSamplespaceGraphicsPanelFun.GetSampleMeasureRect(MeasureItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[(int)IndexNum.First], IsWidth, Width, Height, m_WDomain);
+                            SampleMeasurePara sampleMeasure = OTSSamplespaceGraphicsPanelFun.GetSampleMeasureRect(MeasureItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain);
                             iShape = (DOMAIN_SHAPE)sampleMeasure.iShape;
                             Srect = sampleMeasure.MeasureRect;
                             //设置测量区域形状
@@ -4669,7 +4669,7 @@ namespace OTSMeasureApp
             {
                 if (MeasureItem.IsSingle && MeasureItem.IsWorkSample)
                 {
-                    if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(MeasureItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[(int)IndexNum.First], IsWidth, Width, Height, m_WDomain))
+                    if (OTSSamplespaceGraphicsPanelFun.SetWorkSamplHoleAndMeasureArea(MeasureItem, m_MeasureAppForm, m_OTSSampleStageData, m_RectangleGDIObjects[0], IsWidth, Width, Height, m_WDomain))
                     {
                         IsSingle = true;
                         SampleMeasurePara sampleMeasure = GetSampleMeasureRect(MeasureItem);

+ 42 - 49
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.cs

@@ -29,7 +29,7 @@ namespace OTSMeasureApp
         public byte[] Imagedata = new byte[m_iWidth];
 
         static int m_iWidth = 1024;
-        static int m_iHeight = 768;
+        static int m_iHeight = 704;
 
         OTSImageData m_ImageData = null;
         //获取BSE图时最初的位置
@@ -118,28 +118,19 @@ namespace OTSMeasureApp
 
         public OTSMeasureStatusWindow(OTSIncAMeasureAppForm MeasureApp)
         {
-            
-                InitializeComponent();
-
-                m_MeasureAppForm = MeasureApp;
-                if (m_ImageData == null)
-                {
-                    m_ImageData = new OTSImageData(this, m_MeasureAppForm);
-                }
-
-                //建立图像数据
-                bBseData = new byte[m_iWidth * m_iHeight];
-
-                m_ElementPointGDIObjects = new List<ARectangleGDIObject>();
-
-                //进入时首先对XRayTable进行隐藏
-                panelXray.Visible = false;
-
-                //国际化
-                lan = new OTSSysMgrTools.Language(this);
-                table = lan.GetNameTable(this.Name);
-         
 
+            InitializeComponent();
+            m_MeasureAppForm = MeasureApp;
+            if (m_ImageData == null)
+            {
+                m_ImageData = new OTSImageData(this, m_MeasureAppForm);
+            }
+            m_ElementPointGDIObjects = new List<ARectangleGDIObject>();
+            //进入时首先对XRayTable进行隐藏
+            panelXray.Visible = false;
+            //国际化
+            lan = new OTSSysMgrTools.Language(this);
+            table = lan.GetNameTable(this.Name);
         }
         /// <summary>
         /// 在控件中显示BSE图像
@@ -287,13 +278,15 @@ namespace OTSMeasureApp
             try
             {
                 //获取电镜中图像大小
-                string str = m_MeasureAppForm.m_ProjParam.GetBSEImageSize();
+                string str = m_MeasureAppForm.m_ProjParam.GetBSEImageSize();// 举例:1024X768 
                 string[] sArray = str.Split('X');
-                if (sArray[(int)IndexNum.First] != "" && sArray[(int)IndexNum.Second] != "")
+                if (sArray[0] != "" && sArray[1] != "")
                 {
-                    m_iWidth = Convert.ToInt32(sArray[(int)IndexNum.First]);
-                    m_iHeight = Convert.ToInt32(sArray[(int)IndexNum.Second]);
+                    m_iWidth = Convert.ToInt32(sArray[0]);
+                    m_iHeight = Convert.ToInt32(sArray[1]);
                 }
+                //建立图像数据
+                bBseData = new byte[m_iWidth * m_iHeight];
                 //获取图像数据
                 int nDwellTime = 4;
                 try
@@ -344,7 +337,7 @@ namespace OTSMeasureApp
                 dGrayLevelData = m_ImageData.GetGaryData(bBseData, dGrayLevelData);
 
                 //计算灰度最大值
-                dGrayLevelMax = dGrayLevelData[(int)IndexNum.First];
+                dGrayLevelMax = dGrayLevelData[0];
                 for (int i = 1; i < (int)GrayLevel.Max; i++)
                 {
                     dGrayLevelMax = Math.Max(dGrayLevelMax, dGrayLevelData[i]);
@@ -453,10 +446,10 @@ namespace OTSMeasureApp
                 //获取电镜中图像大小
                 string str = m_MeasureAppForm.m_ProjParam.GetBSEImageSize();
                 string[] sArray = str.Split('X');
-                if (sArray[(int)IndexNum.First] != "" && sArray[(int)IndexNum.Second] != "")
+                if (sArray[0] != "" && sArray[1] != "")
                 {
-                    m_iWidth = Convert.ToInt32(sArray[(int)IndexNum.First]);
-                    m_iHeight = Convert.ToInt32(sArray[(int)IndexNum.Second]);
+                    m_iWidth = Convert.ToInt32(sArray[0]);
+                    m_iHeight = Convert.ToInt32(sArray[1]);
                 }
                 //获取图像数据
                 COTSSample WSample = m_MeasureAppForm.m_ProjData.GetWorkingSample();
@@ -471,7 +464,7 @@ namespace OTSMeasureApp
                 dGrayAbandonLevelData = m_ImageData.GetGrayAbandonData(cBseData, dGrayAbandonLevelData);
 
                 //计算灰度去背景最大值
-                dGrayAbandonLevelMax = dGrayAbandonLevelData[(int)IndexNum.First];
+                dGrayAbandonLevelMax = dGrayAbandonLevelData[0];
                 for (int i = 1; i < (int)GrayLevel.Max; i++)
                 {
                     dGrayAbandonLevelMax = Math.Max(dGrayAbandonLevelMax, dGrayAbandonLevelData[i]);
@@ -1086,7 +1079,7 @@ namespace OTSMeasureApp
                     dGrayAbandonLevelData = new double[(int)GrayLevel.Max];
                     m_ImageData.GetGrayAbandonData(cBseData, dGrayAbandonLevelData);
                     //计算灰度去背景最大值
-                    dGrayAbandonLevelMax = dGrayAbandonLevelData[(int)IndexNum.First];
+                    dGrayAbandonLevelMax = dGrayAbandonLevelData[0];
                     for (int i = 0; i < (int)GrayLevel.Max; i++)
                     {
 
@@ -1424,42 +1417,42 @@ namespace OTSMeasureApp
         public void chartData(int[] XData, int[] YData)
         {
             //添加数据
-            myChart.Series[(int)IndexNum.First].Points.DataBindXY(XData, YData);
-            myChart.Series[(int)IndexNum.First].Label = "";
-            myChart.Series[(int)IndexNum.First].LegendText = "";
+            myChart.Series[0].Points.DataBindXY(XData, YData);
+            myChart.Series[0].Label = "";
+            myChart.Series[0].LegendText = "";
             if (OTSSysMgrTools.Language.ReadDefaultLanguage() == "ZH")
             {
-                myChart.Series[(int)IndexNum.First].Name = "曲线图";
+                myChart.Series[0].Name = "曲线图";
             }
             else
             {
-                myChart.Series[(int)IndexNum.First].Name = "Graph";
+                myChart.Series[0].Name = "Graph";
             }
-            myChart.Series[(int)IndexNum.First].IsVisibleInLegend = false;
+            myChart.Series[0].IsVisibleInLegend = false;
             switch (imagetype)
             {
                 case ImageType.GrayLevelChart:
                     if (OTSSysMgrTools.Language.ReadDefaultLanguage() == "ZH")
                     {
-                        myChart.Titles[(int)IndexNum.First].Text = "灰度曲线图";
+                        myChart.Titles[0].Text = "灰度曲线图";
                     }
                     else
                     {
-                        myChart.Titles[(int)IndexNum.First].Text = "B-GrayCurve";
+                        myChart.Titles[0].Text = "B-GrayCurve";
                     }
                     break;
                 case ImageType.GrayAbandonLevelChart:
                     if (OTSSysMgrTools.Language.ReadDefaultLanguage() == "ZH")
                     {
-                        myChart.Titles[(int)IndexNum.First].Text = "去背景灰度曲线图";
+                        myChart.Titles[0].Text = "去背景灰度曲线图";
                     }
                     else
                     {
-                        myChart.Titles[(int)IndexNum.First].Text = "Background-freeGray-scaleCurve";
+                        myChart.Titles[0].Text = "Background-freeGray-scaleCurve";
                     }
                     break;
                 default:
-                    myChart.Titles[(int)IndexNum.First].Text = "";
+                    myChart.Titles[0].Text = "";
                     break;
             }
         }
@@ -1543,8 +1536,8 @@ namespace OTSMeasureApp
                             if (!strGroup[i].Equals(""))
                             {
                                 ShowElementInfo ls_sei = new ShowElementInfo();
-                                ls_sei.ElementName = strGroup[i].Split(':')[(int)IndexNum.First];
-                                ls_sei.Percentage = Convert.ToDouble(strGroup[i].Split(':')[(int)IndexNum.Second]);
+                                ls_sei.ElementName = strGroup[i].Split(':')[0];
+                                ls_sei.Percentage = Convert.ToDouble(strGroup[i].Split(':')[1]);
                                 list_showelementinfo.Add(ls_sei);
                             }
                         }
@@ -1792,10 +1785,10 @@ namespace OTSMeasureApp
                             {
                                 int sizeChangeX = sizeChangePoint.X - m_GetBSEImageInitPoint.X;
                                 int sizeChangeY = sizeChangePoint.Y - m_GetBSEImageInitPoint.Y;
-                                RectangleF sizeChangeRectF = m_ElementPointGDIObjects[(int)IndexNum.First].RegionF;
-                                sizeChangeRectF.X = m_ElementPointGDIObjects[(int)IndexNum.First].RegionF.X + sizeChangeX;
-                                m_ElementPointGDIObjects[(int)IndexNum.First].RegionF = sizeChangeRectF;
-                                m_ElementPointGDIObjects[(int)IndexNum.First].DrawRegionF = sizeChangeRectF;
+                                RectangleF sizeChangeRectF = m_ElementPointGDIObjects[0].RegionF;
+                                sizeChangeRectF.X = m_ElementPointGDIObjects[0].RegionF.X + sizeChangeX;
+                                m_ElementPointGDIObjects[0].RegionF = sizeChangeRectF;
+                                m_ElementPointGDIObjects[0].DrawRegionF = sizeChangeRectF;
                                 m_GetBSEImageInitPoint = sizeChangePoint;
                             }
                         }

+ 186 - 186
OTSSysMgrTools/ImageDispose.cs

@@ -88,182 +88,182 @@ namespace OTSSysMgrTools
         /// </summary>
         /// <param name="fileUrl">文件路径文件名称</param>
         /// <returns>byte[]</returns>
-        public static byte[] GetFileData(string fileUrl)
-        {
-            FileStream pFileStream = null;
-            byte[] pReadByte = new byte[0];
-            try
-            {
-                //读取文本文件
-                pFileStream = new FileStream(fileUrl, FileMode.Open, FileAccess.Read);
-                //实例读取字节流对象
-                StreamReader sr = new StreamReader(pFileStream, System.Text.Encoding.Default);
-                string temp = sr.ReadToEnd();
-                //转换byte数组
-                byte[] byteArray = System.Text.Encoding.Default.GetBytes(temp);
-                //生成字符数组
-                string[] tempGroup = temp.Split(',');
-                //关闭读取对象
-                sr.Close();
-                string AppendStr = string.Empty;
-                for (int i = 0; i < tempGroup.Length; i++)
-                {
-                    //十进制转十六进制
-                    AppendStr += Convert.ToString(Convert.ToInt32(tempGroup[i]), 16) + " ";
-                }
-                //替换字符符号
-                AppendStr = AppendStr.Replace(" ", "");
-                if ((AppendStr.Length % 2) != 0)
-                {
-                    AppendStr += " ";
-                }
-                byte[] returnBytes = new byte[AppendStr.Length / 2];
-                //转换为byte[]数组
-                for (int i = 0; i < returnBytes.Length; i++)
-                {
-                    returnBytes[i] = Convert.ToByte(AppendStr.Substring(i * 2, 2), 16);
-                }
-                return returnBytes;
-            }
-            catch
-            {
-                return pReadByte;
-            }
-            finally
-            {
-                if (pFileStream != null)
-                    pFileStream.Close();
-            }
-        }
+        //public static byte[] GetFileData(string fileUrl)
+        //{
+        //    FileStream pFileStream = null;
+        //    byte[] pReadByte = new byte[0];
+        //    try
+        //    {
+        //        //读取文本文件
+        //        pFileStream = new FileStream(fileUrl, FileMode.Open, FileAccess.Read);
+        //        //实例读取字节流对象
+        //        StreamReader sr = new StreamReader(pFileStream, System.Text.Encoding.Default);
+        //        string temp = sr.ReadToEnd();
+        //        //转换byte数组
+        //        byte[] byteArray = System.Text.Encoding.Default.GetBytes(temp);
+        //        //生成字符数组
+        //        string[] tempGroup = temp.Split(',');
+        //        //关闭读取对象
+        //        sr.Close();
+        //        string AppendStr = string.Empty;
+        //        for (int i = 0; i < tempGroup.Length; i++)
+        //        {
+        //            //十进制转十六进制
+        //            AppendStr += Convert.ToString(Convert.ToInt32(tempGroup[i]), 16) + " ";
+        //        }
+        //        //替换字符符号
+        //        AppendStr = AppendStr.Replace(" ", "");
+        //        if ((AppendStr.Length % 2) != 0)
+        //        {
+        //            AppendStr += " ";
+        //        }
+        //        byte[] returnBytes = new byte[AppendStr.Length / 2];
+        //        //转换为byte[]数组
+        //        for (int i = 0; i < returnBytes.Length; i++)
+        //        {
+        //            returnBytes[i] = Convert.ToByte(AppendStr.Substring(i * 2, 2), 16);
+        //        }
+        //        return returnBytes;
+        //    }
+        //    catch
+        //    {
+        //        return pReadByte;
+        //    }
+        //    finally
+        //    {
+        //        if (pFileStream != null)
+        //            pFileStream.Close();
+        //    }
+        //}
         #endregion
 
         #region 根据分辨率获取图像
-        public static bool GetScanImage(string ImgWidth, string ImgHeight, string DwellTime, COTSControlFunExport cfun, ref byte[] ImageByte)
-        {
-            try
-            {
-
-                //设置图像分辨率
-                int width = 0;
-                int height = 0;
-                //获取宽度
-                width = Convert.ToInt32(ImgWidth);
-                height = Convert.ToInt32(ImgHeight);
+        //public static bool GetScanImage(string ImgWidth, string ImgHeight, string DwellTime, COTSControlFunExport cfun, ref byte[] ImageByte)
+        //{
+        //    try
+        //    {
+
+        //        //设置图像分辨率
+        //        int width = 0;
+        //        int height = 0;
+        //        //获取宽度
+        //        width = Convert.ToInt32(ImgWidth);
+        //        height = Convert.ToInt32(ImgHeight);
                 
-                int a_ExternalMode = 0;
-                //获取终止模式
-                a_ExternalMode = cfun.GetSemExternalMode();
+        //        int a_ExternalMode = 0;
+        //        //获取终止模式
+        //        a_ExternalMode = cfun.GetSemExternalMode();
                 
-                //保存初始模式变量
-                int a_oldMode = 0;
-                //获取初始模式
-                if (!cfun.GetSemScanMode(ref a_oldMode))
-                {
-                    return false;
-                }
-                //设置当前模式
-                if (!cfun.SetSemScanMode(a_ExternalMode))
-                {
-                    return false;
-                }
+        //        //保存初始模式变量
+        //        int a_oldMode = 0;
+        //        //获取初始模式
+        //        if (!cfun.GetSemScanMode(ref a_oldMode))
+        //        {
+        //            return false;
+        //        }
+        //        //设置当前模式
+        //        if (!cfun.SetSemScanMode(a_ExternalMode))
+        //        {
+        //            return false;
+        //        }
                 
-                #region BeamBlank
-                int a_nBeamBlank = 0;
-                //获取参数
-                if (!cfun.GetSemBeamBlank(ref a_nBeamBlank))
-                {
-                    cfun.SetSemScanMode(a_oldMode);
-                    return false;
-                }
-                //设置参数
-                if (!cfun.SetSemBeamBlank(0))
-                {
-                    cfun.SetSemScanMode(a_oldMode);
-                    return false;
-                }
-                #endregion
+        //        #region BeamBlank
+        //        int a_nBeamBlank = 0;
+        //        //获取参数
+        //        if (!cfun.GetSemBeamBlank(ref a_nBeamBlank))
+        //        {
+        //            cfun.SetSemScanMode(a_oldMode);
+        //            return false;
+        //        }
+        //        //设置参数
+        //        if (!cfun.SetSemBeamBlank(0))
+        //        {
+        //            cfun.SetSemScanMode(a_oldMode);
+        //            return false;
+        //        }
+        //        #endregion
                
-                #region 获得放大倍数
-                //获得放大倍数
-                double a_dMagnification = 0;
-                //获取参数
-                if (!cfun.GetSemMagnification(ref a_dMagnification))
-                {
-                    cfun.SetSemScanMode(a_oldMode);
-                    return false;
-                }
-                #endregion
+        //        #region 获得放大倍数
+        //        //获得放大倍数
+        //        double a_dMagnification = 0;
+        //        //获取参数
+        //        if (!cfun.GetSemMagnification(ref a_dMagnification))
+        //        {
+        //            cfun.SetSemScanMode(a_oldMode);
+        //            return false;
+        //        }
+        //        #endregion
 
 
                 
 
-                #region 获取 电镜 X、Y轴 与角度
-                //获取 电镜 X、Y轴 与角度
-                double PositionX = 0;
-                double PositionY = 0;
-                double PositionR = 0;
-                //获取参数
-                if (!cfun.GetSemPositionXY(ref PositionX, ref PositionY, ref PositionR))
-                {
-                    cfun.SetSemScanMode(a_oldMode);
-                    return false;
-                }
-                #endregion
-
-                #region 设置图像分辨率
-                //设置宽度
-                if (!cfun.SetImageSize(width, height))
-                {
-                    cfun.SetSemScanMode(a_oldMode);
-                    return false;
-                }
-                #endregion
-
-                #region 采集时间
-                //采集时间
-                int nDwellTime = 16;
-                nDwellTime = Convert.ToInt32(DwellTime);
-                //nDwellTime = Convert.ToInt32(tbCollectionTime.Text);
-                //设置采集时间
-                if (!cfun.SetDwellTime(nDwellTime))
-                {
-                    cfun.SetSemScanMode(a_oldMode);
-                    return false;
-                }
-                #endregion
-
-                #region MatrixSize
-                //获得放大倍数
-                int a_MatrixSize = 0;
-                Size size = new Size();
-                //获取参数
-                size = cfun.GetMatrixSize(a_MatrixSize);
-                #endregion
+        //        #region 获取 电镜 X、Y轴 与角度
+        //        //获取 电镜 X、Y轴 与角度
+        //        double PositionX = 0;
+        //        double PositionY = 0;
+        //        double PositionR = 0;
+        //        //获取参数
+        //        if (!cfun.GetSemPositionXY(ref PositionX, ref PositionY, ref PositionR))
+        //        {
+        //            cfun.SetSemScanMode(a_oldMode);
+        //            return false;
+        //        }
+        //        #endregion
+
+        //        #region 设置图像分辨率
+        //        //设置宽度
+        //        if (!cfun.SetImageSize(width, height))
+        //        {
+        //            cfun.SetSemScanMode(a_oldMode);
+        //            return false;
+        //        }
+        //        #endregion
+
+        //        #region 采集时间
+        //        //采集时间
+        //        int nDwellTime = 16;
+        //        nDwellTime = Convert.ToInt32(DwellTime);
+        //        //nDwellTime = Convert.ToInt32(tbCollectionTime.Text);
+        //        //设置采集时间
+        //        if (!cfun.SetDwellTime(nDwellTime))
+        //        {
+        //            cfun.SetSemScanMode(a_oldMode);
+        //            return false;
+        //        }
+        //        #endregion
+
+        //        #region MatrixSize
+        //        //获得放大倍数
+        //        int a_MatrixSize = 0;
+        //        Size size = new Size();
+        //        //获取参数
+        //        size = cfun.GetMatrixSize(a_MatrixSize);
+        //        #endregion
                 
-                //获取图像数据
-                int resultCount = width * height;
-                int GetImgCount = cfun.AcquireBSEImage(0, 0, 0, ref ImageByte);
-
-                if (resultCount == GetImgCount)
-                {
-                    //设置为原始 扫描模式
-                    cfun.SetSemScanMode(a_oldMode);
-                }
-                else
-                {
-                    cfun.SetSemScanMode(a_oldMode);
-                }
-                return true;
-
-            }
-            catch (Exception ex)
-            {
-                //记录日志
-                 //NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
-                 // log.Error(ex.Message.ToString());
-                return false;
-            }
-        }
+        //        //获取图像数据
+        //        int resultCount = width * height;
+        //        int GetImgCount = cfun.AcquireBSEImage(0, 0, 0, ref ImageByte);
+
+        //        if (resultCount == GetImgCount)
+        //        {
+        //            //设置为原始 扫描模式
+        //            cfun.SetSemScanMode(a_oldMode);
+        //        }
+        //        else
+        //        {
+        //            cfun.SetSemScanMode(a_oldMode);
+        //        }
+        //        return true;
+
+        //    }
+        //    catch (Exception ex)
+        //    {
+        //        //记录日志
+        //         //NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
+        //         // log.Error(ex.Message.ToString());
+        //        return false;
+        //    }
+        //}
         #endregion
 
         public static int GetScanImage(int iWidth, int iHeigh, string DwellTime, ref byte[] bImageData)
@@ -423,30 +423,30 @@ namespace OTSSysMgrTools
         /// </summary>
         /// <param name="buff">byte数组</param>
         /// <param name="savepath">保存地址</param>
-        public static void BytesConvertToFile(byte[] buff, string savepath, string fileName)
-        {
-            try
-            {
-
-                //如果不存在就创建Enclosure文件夹 
-                if (Directory.Exists(savepath + @"\Enclosure\") == false)
-                {
-                    Directory.CreateDirectory(savepath + @"\Enclosure\");
-                }
-
-                if (System.IO.File.Exists(savepath + @"\Enclosure\" + fileName))
-                {
-                    System.IO.File.Delete(savepath + @"\Enclosure\" + fileName);
-                }
-                Bitmap bitmap=ToGrayBitmap(buff, 1024, 768);
+        //public static void BytesConvertToFile(byte[] buff, string savepath, string fileName)
+        //{
+        //    try
+        //    {
+
+        //        //如果不存在就创建Enclosure文件夹 
+        //        if (Directory.Exists(savepath + @"\Enclosure\") == false)
+        //        {
+        //            Directory.CreateDirectory(savepath + @"\Enclosure\");
+        //        }
+
+        //        if (System.IO.File.Exists(savepath + @"\Enclosure\" + fileName))
+        //        {
+        //            System.IO.File.Delete(savepath + @"\Enclosure\" + fileName);
+        //        }
+        //        Bitmap bitmap=ToGrayBitmap(buff, 1024, 768);
                
-                bitmap.Save(savepath + @"\Enclosure\" + fileName);
+        //        bitmap.Save(savepath + @"\Enclosure\" + fileName);
                 
-            }
-            catch (Exception)
-            {
+        //    }
+        //    catch (Exception)
+        //    {
 
-            }
-        }
+        //    }
+        //}
     }
 }

+ 4 - 6
OTSSysMgrTools/OTSSysMgrTools.csproj

@@ -74,6 +74,10 @@
     <ErrorReport>prompt</ErrorReport>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="OTSClrInterface, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\Bin\Win32\Debug\OTSClrInterface.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Data.SQLite, Version=1.0.113.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=AMD64">
@@ -103,11 +107,5 @@
     <Compile Include="SQliteManageClass.cs" />
     <Compile Include="XMLManageClass.cs" />
   </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\OTSCPP\OTSClrInterface\OTSClrInterface.vcxproj">
-      <Project>{490a8592-7b13-4536-b475-028e73007fae}</Project>
-      <Name>OTSClrInterface</Name>
-    </ProjectReference>
-  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>