public bool ShowCornerResult(PictureBox display) { bool reSuccess = false; try { float scalingRatio = ScalingRatio(eFindCorner[CornerLine.Line_1].InputImage, display); eFindCorner[CornerLine.Line_1].Base.SetZoom(scalingRatio, scalingRatio); eFindCorner[CornerLine.Line_1].Base.SetPan(0, 0); eFindCorner[CornerLine.Line_2].Base.SetZoom(scalingRatio, scalingRatio); eFindCorner[CornerLine.Line_2].Base.SetPan(0, 0); Bitmap bmp = new Bitmap(InputImage.Width, InputImage.Height); eFindCorner[CornerLine.Line_1].Base.Draw(Graphics.FromImage(bmp), EDrawingMode.SampledPoints); eFindCorner[CornerLine.Line_1].Base.Draw(Graphics.FromImage(bmp), EDrawingMode.Actual); eFindCorner[CornerLine.Line_2].Base.Draw(Graphics.FromImage(bmp), EDrawingMode.SampledPoints); eFindCorner[CornerLine.Line_2].Base.Draw(Graphics.FromImage(bmp), EDrawingMode.Actual); ezPoint ezPoint = new ezPoint(); GetCornerResults(ref ezPoint); EPoint ePoint = new EPoint((float)ezPoint.x, (float)ezPoint.y); ELineGauge line_1 = new ELineGauge(); ELineGauge line_2 = new ELineGauge(); //line_1.Attach(eFixture.Base); //line_2.Attach(eFixture.Base); line_1.SetCenterXY(ePoint.X, ePoint.Y); line_2.SetCenterXY(ePoint.X, ePoint.Y); line_1.Angle = eFindCorner[CornerLine.Line_1].Position_Angle + eFixture.Angle; line_2.Angle = eFindCorner[CornerLine.Line_2].Position_Angle + eFixture.Angle; line_1.SetZoom(scalingRatio, scalingRatio); line_2.SetZoom(scalingRatio, scalingRatio); line_1.SetPan(0, 0); line_2.SetPan(0, 0); line_1.Draw(Graphics.FromImage(bmp), new ERGBColor(255, 0, 0), EDrawingMode.Actual); line_2.Draw(Graphics.FromImage(bmp), new ERGBColor(255, 0, 0), EDrawingMode.Actual); if (display.InvokeRequired) { display.Invoke(new Action(() => { display.Image = bmp; })); } else { display.Image = bmp; } reSuccess = true; } catch (EException exc) { StackFrame[] stackFrames = new StackTrace(true).GetFrames(); clsLogFile.LogTryCatch(stackFrames, exc.Message, true, true); } catch (Exception ex) { StackFrame[] stackFrames = new StackTrace(true).GetFrames(); clsLogFile.LogTryCatch(stackFrames, ex.Message, true, true); } return(reSuccess); }
public override void Initialize() { LineGauge = new ELineGauge(); LineGauge.Rotatable = true; LineGauge.Resizable = true; LineGauge.Dragable = true; LineGauge.SetCenterXY(0, 0); LineGauge.Length = 200; LineGauge.Tolerance = 50; ResultData.Name = lineConfig.ToolName; ResultData.ValueParams.Clear(); ResultData.ValueParams.Add("中心X", new float[] { 0 }); ResultData.ValueParams.Add("中心Y", new float[] { 0 }); ResultData.ValueParams.Add("角度", new float[] { 0 }); ResultData.ValueParams.Add("异常点数", new float[] { 0 }); ParentTask.ResultDatas.Add(ResultData); }