Przeglądaj źródła

delete enum IndexNum

zhangjiaxin 4 lat temu
rodzic
commit
c250dfe9d4

+ 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);

+ 23 - 23
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.cs

@@ -337,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]);
@@ -446,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();
@@ -464,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]);
@@ -1079,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++)
                     {
 
@@ -1417,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;
             }
         }
@@ -1536,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);
                             }
                         }
@@ -1785,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;
                             }
                         }