コード例 #1
0
 private void pictureBox1_Paint(object sender, PaintEventArgs e)
 {
     drawGrids(e);
     drawAll(e);
     if (realTime)
     {
         Graphics g = e.Graphics;
         if (drawFinished)
         {
             g.FillRectangle(new SolidBrush(Color.FromArgb(122, 122, 122)), realTimePoint.X, realTimePoint.Y, 10, 10);
         }
         else
         {
             if (lineDrawing)
             {
                 if (0 == lineList.Count())
                 {
                     return;
                 }
                 Point  from = lineList[lineList.Count() - 1].toNode;
                 MyLine line = new MyLine(from, realTimePoint);
                 line.setDrawIn(drawIn);
                 line.drawMyself(e, Color.FromArgb(122, 122, 122), assistShow);
             }
             else if (polylineDrawing)
             {
                 if (0 == polylineList.Count())
                 {
                     return;
                 }
                 Point  from = polylineList[polylineList.Count() - 1].containList[polylineList[polylineList.Count() - 1].containList.Count() - 1];
                 MyLine line = new MyLine(from, realTimePoint);
                 line.setDrawIn(drawIn);
                 line.drawMyself(e, Color.FromArgb(122, 122, 122), assistShow);
             }
             else if (circleDrawing)
             {
                 if (0 == circleList.Count())
                 {
                     return;
                 }
                 int      r      = Convert.ToInt32(circleList[circleList.Count() - 1].getDistance(realTimePoint)) / 10 * 10;
                 MyCircle circle = new MyCircle(circleList[circleList.Count() - 1].center, r);
                 circle.setDrawIn(drawIn);
                 circle.drawMyself(e, Color.FromArgb(122, 122, 122), assistShow);
             }
         }
     }
 }
コード例 #2
0
        private void newAdd(Point p)
        {
            if (multiDrawing)
            {
                if (mixShow)
                {
                    if (drawFinished)
                    {
                        drawFinished = false;
                        if (lineDrawing)
                        {
                            MyLine newline = new MyLine(p, p);
                            newline.setDrawIn(drawIn);
                            lineList.Add(newline);
                        }
                        else if (polylineDrawing)
                        {
                            MyPolyline newpolyline = new MyPolyline(new List <Point> {
                            });
                            newpolyline.setDrawIn(drawIn);
                            newpolyline.Add(p);
                            polylineList.Add(newpolyline);
                            //polylineList[polylineList.Count() - 1].Add(p);
                        }
                        else if (circleDrawing)
                        {
                            MyCircle newcircle = new MyCircle(p);
                            newcircle.setDrawIn(drawIn);
                            circleList.Add(newcircle);
                        }
                    }
                    else
                    {
                        if (lineDrawing)
                        {
                            drawFinished = true;

                            MyLine newline = new MyLine(lineList[lineList.Count() - 1].fromNode, p);
                            newline.setDrawIn(drawIn);
                            lineList[lineList.Count() - 1] = newline;
                        }
                        else if (polylineDrawing)
                        {
                            polylineList[polylineList.Count() - 1].Add(p);
                        }
                        else if (circleDrawing)
                        {
                            drawFinished = true;
                            int      r         = Convert.ToInt32(circleList[circleList.Count() - 1].getDistance(p)) / 10 * 10;
                            MyCircle newcircle = new MyCircle(circleList[circleList.Count() - 1].center, r);
                            newcircle.setDrawIn(drawIn);
                            circleList[circleList.Count() - 1] = newcircle;
                        }
                    }
                }
                else
                {
                    if (drawFinished)
                    {
                        drawFinished = false;
                        if (lineDrawing)
                        {
                            MyLine newline = new MyLine(p, p);
                            newline.setDrawIn(drawIn);
                            lineList.Add(newline);
                            circleList.Clear();
                            polylineList.Clear();
                        }
                        else if (polylineDrawing)
                        {
                            MyPolyline newpolyline = new MyPolyline(new List <Point> {
                            });
                            newpolyline.setDrawIn(drawIn);
                            newpolyline.Add(p);
                            polylineList.Add(newpolyline);
                            lineList.Clear();
                            circleList.Clear();
                        }
                        else if (circleDrawing)
                        {
                            MyCircle newcircle = new MyCircle(p);
                            newcircle.setDrawIn(drawIn);
                            circleList.Add(newcircle);
                            lineList.Clear();
                            polylineList.Clear();
                        }
                    }
                    else
                    {
                        if (lineDrawing)
                        {
                            drawFinished = true;
                            circleList.Clear();
                            polylineList.Clear();
                            MyLine newer = new MyLine(lineList[lineList.Count() - 1].fromNode, p);
                            newer.setDrawIn(drawIn);
                            lineList[lineList.Count() - 1] = newer;
                        }
                        else if (polylineDrawing)
                        {
                            polylineList[polylineList.Count() - 1].Add(p);
                            lineList.Clear();
                            circleList.Clear();
                        }
                        else if (circleDrawing)
                        {
                            drawFinished = true;
                            lineList.Clear();
                            polylineList.Clear();
                            int      r     = Convert.ToInt32(circleList[circleList.Count() - 1].getDistance(p)) / 10 * 10;
                            MyCircle newer = new MyCircle(circleList[circleList.Count() - 1].center, r);
                            newer.setDrawIn(drawIn);
                            circleList[circleList.Count() - 1] = newer;
                        }
                    }
                }
            }
            else
            {
                if (drawFinished)
                {
                    lineList.Clear();
                    polylineList.Clear();
                    circleList.Clear();
                    drawFinished = false;
                    if (lineDrawing)
                    {
                        MyLine newline = new MyLine(p, p);
                        newline.setDrawIn(drawIn);
                        lineList.Add(newline);
                    }
                    else if (polylineDrawing)
                    {
                        MyPolyline newpolyline = new MyPolyline(new List <Point> {
                        });
                        newpolyline.setDrawIn(drawIn);
                        newpolyline.Add(p);
                        polylineList.Add(newpolyline);
                    }
                    else if (circleDrawing)
                    {
                        MyCircle newcircle = new MyCircle(p);
                        newcircle.setDrawIn(drawIn);
                        circleList.Add(newcircle);
                    }
                }
                else
                {
                    if (lineDrawing)
                    {
                        drawFinished = true;
                        MyLine newer = new MyLine(lineList[0].fromNode, p);
                        newer.setDrawIn(drawIn);
                        lineList[0] = newer;
                    }
                    else if (polylineDrawing)
                    {
                        polylineList[0].Add(p);
                    }
                    else if (circleDrawing)
                    {
                        drawFinished = true;
                        int      r     = Convert.ToInt32(circleList[0].getDistance(p)) / 10 * 10;
                        MyCircle newer = new MyCircle(circleList[0].center, r);
                        newer.setDrawIn(drawIn);
                        circleList[0] = newer;
                    }
                }
            }
        }