Ejemplo n.º 1
0
        public override void Invalidate()
        {
            Point p = Point;

            p.Offset(-5, -5);
            if (Model != null)
            {
                Model.RaiseOnInvalidateRectangle(new Rectangle(p, new Size(10, 10)));
            }
        }
Ejemplo n.º 2
0
        public override void Invalidate()
        {
            Rectangle r = Rectangle;

            r.Offset(-10, -10);
            r.Inflate(40, 40);
            if (Model != null)
            {
                Model.RaiseOnInvalidateRectangle(r);
            }
        }
Ejemplo n.º 3
0
        public override void Invalidate()
        {
            if (mRectangle == null)
            {
                return;
            }
            Rectangle rec = mRectangle;

            rec.Inflate(20, 20);
            Model.RaiseOnInvalidateRectangle(rec);
        }
Ejemplo n.º 4
0
        public override void Move(Point p)
        {
            Point       pt = new Point(this.Point.X + p.X, this.Point.Y + p.Y);
            IConnection con = null;
            Point       p1 = Point.Empty, p2 = Point.Empty;
            Rectangle   rec = new Rectangle(Point.X - 10, Point.Y - 10, 20, 20);

            this.Point = pt;

            #region Case of connection
            if (typeof(IConnection).IsInstanceOfType(this.Parent))
            {
                (Parent as IConnection).Invalidate();
            }
            #endregion

            #region Case of attached connectors
            for (int k = 0; k < AttachedConnectors.Count; k++)
            {
                if (typeof(IConnection).IsInstanceOfType(AttachedConnectors[k].Parent))
                {
                    //keep a reference to the two points so we can invalidate the region afterwards
                    con = AttachedConnectors[k].Parent as IConnection;
                    p1  = con.From.Point;
                    p2  = con.To.Point;
                }
                AttachedConnectors[k].Move(p);
                if (con != null)
                {
                    //invalidate the 'before the move'-region
                    Rectangle f = new Rectangle(p1, new Size(10, 10));
                    Rectangle t = new Rectangle(p2, new Size(10, 10));
                    Model.RaiseOnInvalidateRectangle(Rectangle.Union(f, t));
                    //finally, invalidate the region where the connection is now
                    (AttachedConnectors[k].Parent as IConnection).Invalidate();
                }
            }
            #endregion
            //invalidate this connector, since it's been moved
            Invalidate(rec);   //before the move
            this.Invalidate(); //after the move
        }