Пример #1
0
        public void onPicturboxMove(Point p, object sender)
        {
            basePic           basepic     = sender as basePic;
            List <PictureBox> inputboxes  = basepic.getInputBox();
            List <PictureBox> outputboxes = basepic.getOutputBox();

            foreach (Line l in lines)
            {
                foreach (PictureBox start in outputboxes)
                {
                    if (l.startBox == start)
                    {
                        l.StartPoint.X += p.X;
                        l.StartPoint.Y += p.Y;
                        l.StartPoint.X  = l.StartPoint.X > 0 ? l.StartPoint.X : 0;
                        l.StartPoint.Y  = l.StartPoint.Y > 0 ? l.StartPoint.Y : 0;
                        break;
                    }
                }
                foreach (PictureBox end in inputboxes)
                {
                    if (l.EndBox == end)
                    {
                        l.EndPoint.X += p.X;
                        l.EndPoint.Y += p.Y;
                        l.EndPoint.X  = l.EndPoint.X > 0 ? l.EndPoint.X : 0;
                        l.EndPoint.Y  = l.EndPoint.Y > 0 ? l.EndPoint.Y : 0;
                        break;
                    }
                }
            }
            this.Invalidate();
        }
Пример #2
0
        public void endDrawing(Point p, object sender, PictureBox box)
        {
            basePic baseBox = sender as basePic;

            if (drawingLine == null)
            {
                return;
            }
            if (baseBox == drawingLine.startBasePic)
            {
                return;
            }
            foreach (Line l in lines)
            {
                if (box == l.EndBox)
                {
                    lines.Remove(l);
                    this.Invalidate();
                    break;
                }
            }
            drawingLine.EndPoint   = p;
            drawingLine.EndBox     = box;
            drawingLine.endBasePic = baseBox;
            drawingLine            = null;
        }
Пример #3
0
        public void initDrawPen(Point p, object sender, PictureBox box)
        {
            basePic baseBox = sender as basePic;

            if (null != drawingLine)
            {
                return;
            }
            foreach (Line l in lines)
            {
                if (box == l.startBox)
                {
                    lines.Remove(l);
                    this.Invalidate();
                    break;
                }
            }
            drawingLine = new Line(p);
            drawingLine.startBasePic = baseBox;
            drawingLine.startBox     = box;
            lines.Add(drawingLine);
            bDrawLine = true;
        }