コード例 #1
0
 private void DrawGuideLine(MouseEventArgs e, bool isTransZero)
 {
     if (isTransZero && _zeroStart != null)
     {
         Utils.Drawing.LineParam guideLine = new Utils.Drawing.LineParam();
         guideLine.Source = (Point)_zeroStart;
         Pen testPen = new Pen(Color.Black, 4);
         testPen.EndCap        = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
         guideLine.Destination = e.Location;
         guideLine.LineColor   = testPen;
         Utils.Drawing.DrawLine(drawingBoard, guideLine, false);
         _lastGuideLine = guideLine;
     }
     else if (!isTransZero && _oneStart != null)
     {
         Utils.Drawing.LineParam guideLine = new Utils.Drawing.LineParam();
         guideLine.Source = (Point)_oneStart;
         Pen testPen = new Pen(Color.Blue, 4);
         testPen.EndCap        = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
         guideLine.Destination = e.Location;
         guideLine.LineColor   = testPen;
         Utils.Drawing.DrawLine(drawingBoard, guideLine, false);
         _lastGuideLine = guideLine;
     }
 }
コード例 #2
0
        private void DrawLine(MagnetPoint source, MagnetPoint desti, string input, bool create, bool fix)
        {
            Point ptSrc = source.indexPoint;

            source.State.SetPointIndexUsed(ptSrc, create);
            Point ptDst = desti.indexPoint;

            desti.State.SetPointIndexUsed(ptDst, create);

            Utils.Drawing.LineParam dummy = new Utils.Drawing.LineParam();
            dummy.Source      = ptSrc;
            dummy.Destination = ptDst;
            Pen testPen;

            if (create)
            {
                if (input == "0")
                {
                    testPen = new Pen(Color.Black, 4);
                }
                else
                {
                    testPen = new Pen(Color.Blue, 4);
                }
            }
            else
            {
                testPen = new Pen(Color.White, 4);
            }

            testPen.EndCap  = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
            dummy.LineColor = testPen;
            Utils.Drawing.DrawLine(_drawingBoard, dummy, fix);
        }
コード例 #3
0
        private void _lstState_StateSetStart(State_Wrapper sender, EventArgs e)
        {
            if (_dfa.StartState != "")
            {
                //remove the old StartState
                State_Wrapper           xyz      = GetState(_dfa.StartState);
                Utils.Drawing.LineParam olddummy = new Utils.Drawing.LineParam();
                olddummy.Source      = new Point(xyz.SetStartPoint.X - 25, xyz.SetStartPoint.Y);
                olddummy.Destination = xyz.SetStartPoint;
                Pen oldtestPen = new Pen(Color.White, 4);
                oldtestPen.EndCap  = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
                olddummy.LineColor = oldtestPen;
                Utils.Drawing.DrawLine(_drawingBoard, olddummy, true);
            }
            Utils.Drawing.LineParam dummy = new Utils.Drawing.LineParam();
            dummy.Source      = new Point(sender.SetStartPoint.X - 25, sender.SetStartPoint.Y);
            dummy.Destination = sender.SetStartPoint;
            Pen testPen = new Pen(Color.Black, 4);

            testPen.EndCap  = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
            dummy.LineColor = testPen;
            Utils.Drawing.DrawLine(_drawingBoard, dummy, true);
            _startStatePos      = dummy;
            _dfa.StartState     = sender.Name;
            sender.IsStartState = true;
            DFAIsEdited?.Invoke();
        }
コード例 #4
0
        private void DrawArcToSelf(MagnetPoint source, bool create, bool iszro, bool fix)
        {
            Utils.Drawing.LineParam dummy = new Utils.Drawing.LineParam();
            Pen testPen;

            if (create)
            {
                if (iszro)
                {
                    testPen = new Pen(Color.Black, 4);
                }
                else
                {
                    testPen = new Pen(Color.Blue, 4);
                }
            }
            else
            {
                testPen = new Pen(Color.White, 4);
            }

            Point reference = source.State.CenterLocation;

            if (iszro)
            {
                Point left  = new Point(reference.X - 5, reference.Y - 20);
                Point right = new Point(reference.X + 5, reference.Y - 20);
                dummy.Source      = source.State.GetPointIndex(left);
                dummy.Destination = source.State.GetPointIndex(right);
            }
            else
            {
                Point left  = new Point(reference.X - 5, reference.Y + 20);
                Point right = new Point(reference.X + 5, reference.Y + 20);
                dummy.Source      = source.State.GetPointIndex(left);
                dummy.Destination = source.State.GetPointIndex(right);
            }
            testPen.EndCap  = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
            dummy.LineColor = testPen;
            Utils.Drawing.DrawArc(_drawingBoard, dummy, iszro, fix);
        }