/// <summary> /// Constructor /// </summary> /// <param name="flowChart"></param> /// <param name="panel"></param> /// <param name="flowItem"></param> /// <param name="ctlBase"></param> /// <param name="pathSeg"></param> public SegmentCtl(SMGenericFlowChart flowChart, Panel panel, SMFlowBase flowItem, SMCtlBase ctlBase, SMPathSegment pathSeg) { _flowChart = flowChart; _panel = panel; _flowItem = flowItem; _ctlBase = ctlBase; _pathSeg = pathSeg; ArrowEnd = IsLast; InitializeComponent(); }
private float GetGridDistanceY(int signValue) { return(SMGenericFlowChart.PixelToGridY(_rcHead.Height) * Math.Sign(signValue)); }
private void NewGridDistanceY(int newPixDistance) { NewGridDistance(SMGenericFlowChart.PixelToGridY(newPixDistance)); }
public PointF MoveIt(ref SMFlowBase.eDir dir, PointF startGridPt, bool vertical) { _lineWidth = IsEditable ? 8 : 2; Vertical = vertical; PointF endGridPt = startGridPt; float gridDistance = _pathSeg.GridDistance; Point startPt = SMGenericFlowChart.GridToPixel(startGridPt); int pixDistance = 0; int halfLine = _lineWidth / 2; if (vertical) { endGridPt.Y += gridDistance; pixDistance = SMGenericFlowChart.GridToPixelY(gridDistance); } else { endGridPt.X += gridDistance; pixDistance = SMGenericFlowChart.GridToPixelX(gridDistance); } Point loc = startPt; Size size = Size.Empty; if (vertical) { size = new Size(_lineWidth, Math.Abs(pixDistance) + _lineWidth); if (pixDistance >= 0) { // Down dir = SMFlowBase.eDir.Down; loc.Offset(-halfLine, -halfLine); } else { // Up dir = SMFlowBase.eDir.Up; loc.Offset(-halfLine, pixDistance - halfLine); } } else { size = new Size(Math.Abs(pixDistance) + _lineWidth, _lineWidth); if (pixDistance >= 0) { // Right dir = SMFlowBase.eDir.Right; loc.Offset(-halfLine, -halfLine); } else { // Left dir = SMFlowBase.eDir.Left; loc.Offset(pixDistance - halfLine, -halfLine); } } _dir = dir; Location = loc; Size = size; if (IsLast) { _flowItem.ParentPanel.DetermineTarget(FirstPathSeg, endGridPt); } return(endGridPt); }