Пример #1
0
        // event consumers:
        protected virtual void HandleBoundsChange(BoundsChange evt)
        {
            var moved = !evt.Bounds.SamePosition (evt.OldBounds);

            // if we moved, cause our parent to draw exposed region
            if (moved && Parent != null) {
                List<BoundingRect> dirtyRects;
                evt.OldBounds.SplitIntersection (evt.Bounds, out dirtyRects);
                dirtyRects.ForEach (Parent.Render);
            }

            // we might need to rerender the whole thing on bounds change...
            // even if we didn't move, scaling could have affected our whole content.
            if (moved || ScaleX != 1 || ScaleY != 1)
                Render ();
        }
Пример #2
0
        public BoundsChange UpdateBounds(double X, double Y, double Width, double Height)
        {
            var old = Clone ();

            x = X;
            y = Y;
            width = Width;
            height = Height;

            var evt = new BoundsChange (old, this);
            Change.Fire (evt);
            return evt;
        }