Пример #1
0
        protected internal virtual void SetBoundsChanged(float centerX, float centerY, float rotateAngle, float skewX, float skewY, float scaleX, float scaleY, PointF[] polygon, DUIBoundsPolygonSpecified specified)
        {
            var   polygonRect = PolygonTools.GetPolygonRect(polygon);
            float x           = polygonRect.X;
            float y           = polygonRect.Y;
            float width       = polygonRect.Width;
            float height      = polygonRect.Height;

            if ((specified & DUIBoundsPolygonSpecified.CenterX) == DUIBoundsPolygonSpecified.None)
            {
                centerX = this.mouseDownCenter.X;
            }
            if ((specified & DUIBoundsPolygonSpecified.CenterY) == DUIBoundsPolygonSpecified.None)
            {
                centerY = this.mouseDownCenter.Y;
            }
            if ((specified & DUIBoundsPolygonSpecified.RotateAngle) == DUIBoundsPolygonSpecified.None)
            {
                rotateAngle = this.mouseDownRotateAngle;
            }
            if ((specified & DUIBoundsPolygonSpecified.SkewX) == DUIBoundsPolygonSpecified.None)
            {
                skewX = this.mouseDownSkew.X;
            }
            if ((specified & DUIBoundsPolygonSpecified.SkewY) == DUIBoundsPolygonSpecified.None)
            {
                skewY = this.mouseDownSkew.Y;
            }
            if ((specified & DUIBoundsPolygonSpecified.ScaleX) == DUIBoundsPolygonSpecified.None)
            {
                scaleX = this.mouseDownScale.X;
            }
            if ((specified & DUIBoundsPolygonSpecified.ScaleY) == DUIBoundsPolygonSpecified.None)
            {
                scaleY = this.mouseDownScale.Y;
            }
            if ((specified & DUIBoundsPolygonSpecified.Polygon) == DUIBoundsPolygonSpecified.None)
            {
                polygon = this.mouseDownPolygon;
            }
            if (this.mouseDownBounds.X != x ||
                this.mouseDownBounds.Y != y ||
                this.mouseDownBounds.Width != width ||
                this.mouseDownBounds.Height != height ||
                this.mouseDownCenter.X != centerX ||
                this.mouseDownCenter.Y != centerY ||
                this.mouseDownRotateAngle != rotateAngle ||
                this.mouseDownSkew.X != skewX ||
                this.mouseDownSkew.Y != skewY ||
                this.mouseDownScale.X != scaleX ||
                this.mouseDownScale.Y != scaleY ||
                !PolygonTools.PolygonEquels(this.mouseDownPolygon, polygon))
            {
                UpdateBoundsChanged(x, y, width, height, centerX, centerY, rotateAngle, skewX, skewY, scaleX, scaleY, polygon);
            }
        }
Пример #2
0
        public virtual void SetBounds(float centerX, float centerY, float rotateAngle, float skewX, float skewY, float scaleX, float scaleY, PointF[] polygon, DUIBoundsPolygonSpecified specified, bool invalidate = true)
        {
            var   polygonRect = PolygonTools.GetPolygonRect(polygon);
            float x           = polygonRect.X;
            float y           = polygonRect.Y;
            float width       = polygonRect.Width;
            float height      = polygonRect.Height;

            if ((specified & DUIBoundsPolygonSpecified.CenterX) == DUIBoundsPolygonSpecified.None)
            {
                centerX = this.centerX;
            }
            if ((specified & DUIBoundsPolygonSpecified.CenterY) == DUIBoundsPolygonSpecified.None)
            {
                centerY = this.centerY;
            }
            if ((specified & DUIBoundsPolygonSpecified.RotateAngle) == DUIBoundsPolygonSpecified.None)
            {
                rotateAngle = this.rotate;
            }
            if ((specified & DUIBoundsPolygonSpecified.SkewX) == DUIBoundsPolygonSpecified.None)
            {
                skewX = this.skewX;
            }
            if ((specified & DUIBoundsPolygonSpecified.SkewY) == DUIBoundsPolygonSpecified.None)
            {
                skewY = this.skewY;
            }
            if ((specified & DUIBoundsPolygonSpecified.ScaleX) == DUIBoundsPolygonSpecified.None)
            {
                scaleX = this.scaleX;
            }
            if ((specified & DUIBoundsPolygonSpecified.ScaleY) == DUIBoundsPolygonSpecified.None)
            {
                scaleY = this.scaleY;
            }
            if ((specified & DUIBoundsPolygonSpecified.Polygon) == DUIBoundsPolygonSpecified.None)
            {
                polygon = this.polygon;
            }
            if (this.x != x ||
                this.y != y ||
                this.width != width ||
                this.height != height ||
                this.centerX != centerX ||
                this.centerY != centerY ||
                this.rotate != rotateAngle ||
                this.skewX != skewX ||
                this.skewY != skewY ||
                this.scaleX != scaleX ||
                this.scaleY != scaleY ||
                !PolygonTools.PolygonEquels(this.polygon, polygon))
            {
                UpdateBounds(x, y, width, height, centerX, centerY, rotateAngle, skewX, skewY, scaleX, scaleY, polygon, invalidate);
            }
        }
Пример #3
0
        protected internal virtual void UpdateBoundsChanging(float x, float y, float width, float height, float centerX, float centerY, float rotateAngle, float skewX, float skewY, float scaleX, float scaleY, PointF[] polygon)
        {
            RectangleF lastBounds      = new RectangleF(this.x, this.y, this.width, this.height);
            PointF     lastCenter      = new PointF(this.centerX, this.centerY);
            PointF     lastSkew        = new PointF(this.skewX, this.skewY);
            PointF     lastScale       = new PointF(this.scaleX, this.scaleY);
            float      lastRotateAngle = this.rotate;

            PointF[] lastPolygon    = this.polygon;
            bool     newLocation    = this.x != x || this.y != y;
            bool     newSize        = this.width != width || this.height != height;
            bool     newCenter      = this.centerX != centerX || this.centerY != centerY;
            bool     newSkew        = this.skewX != skewX || this.skewY != skewY;
            bool     newScale       = this.scaleX != scaleX || this.scaleY != scaleY;
            bool     newRotateAngle = this.rotate != rotateAngle;
            bool     newPolygon     = !PolygonTools.PolygonEquels(this.polygon, polygon);

            this.x       = x;
            this.y       = y;
            this.width   = width;
            this.height  = height;
            this.centerX = centerX;
            this.centerY = centerY;
            this.rotate  = rotateAngle;
            this.skewX   = skewX;
            this.skewY   = skewY;
            this.scaleX  = scaleX;
            this.scaleY  = scaleY;
            this.polygon = polygon.ToArray();
            if (newLocation || newSize || newCenter || newSkew || newScale || newRotateAngle || newPolygon)
            {
                this.Invalidate();
            }
            if (newLocation)
            {
                OnLocationChanging(new DUILocationChangingEventArgs(new PointF(this.x, this.y), lastBounds.Location));
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlLocationChanging(new DUIControlLocationChangingEventArgs(this, new PointF(this.x, this.y), lastBounds.Location));
                }
                LayoutEngine.DoLayoutDock(new DUILayoutEventArgs(this.DUIParent, "OnResizing"));
            }
            if (newSize)
            {
                OnResizing(new DUISizeChangingEventArgs(new SizeF(this.width, this.height), lastBounds.Size));
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlSizeChanging(new DUIControlSizeChangingEventArgs(this, new SizeF(this.width, this.height), lastBounds.Size));
                }
                LayoutEngine.DoLayoutDock(new DUILayoutEventArgs(this.DUIParent, "OnResizing"));
                LayoutEngine.DoLayoutDock(new DUILayoutEventArgs(this, "OnResizing"), lastBounds.Size);
            }
            if (newLocation || newSize)
            {
                OnBoundsChanging(new DUIBoundsChangingEventArgs(new RectangleF(this.x, this.y, this.width, this.height), lastBounds));
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlBoundsChanging(new DUIControlBoundsChangingEventArgs(this, new RectangleF(this.x, this.y, this.width, this.height), lastBounds));
                }
            }
            if (newCenter)
            {
                OnCenterChanging(new DUICenterChangingEventArgs(new PointF(this.centerX, this.centerY), lastCenter));
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlCenterChanging(new DUIControlCenterChangingEventArgs(this, new PointF(this.centerX, this.centerY), lastCenter));
                }
            }
            if (newSkew)
            {
                OnSkewChanging(new DUISkewChangingEventArgs(new PointF(this.skewX, this.skewY), lastSkew));
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlSkewChanging(new DUIControlSkewChangingEventArgs(this, new PointF(this.skewX, this.skewY), lastSkew));
                }
            }
            if (newScale)
            {
                OnScaleChanging(new DUIScaleChangingEventArgs(new PointF(this.scaleX, this.scaleY), lastScale));
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlScaleChanging(new DUIControlScaleChangingEventArgs(this, new PointF(this.scaleX, this.scaleY), lastSkew));
                }
            }
            if (newRotateAngle)
            {
                OnRotateAngleChanging(new DUIRotateAngleChangingEventArgs(this.rotate, lastRotateAngle));
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlRotateAngleChanging(new DUIControlRotateAngleChangingEventArgs(this, this.rotate, lastRotateAngle));
                }
            }
            if (newPolygon)
            {
                OnPolygonChanging(new DUIPolygonChangingEventArgs(this.polygon, lastPolygon));
            }
            if (newLocation || newSize || newCenter || newRotateAngle || newSkew || newScale || newPolygon)
            {
                OnPolygonAnyChanging(new DUIPolygonAnyChangingEventArgs(new RectangleF(this.x, this.y, this.width, this.height), lastBounds, new PointF(this.centerX, this.centerY), lastCenter, new PointF(this.skewX, this.skewY), lastSkew, new PointF(this.scaleX, this.scaleY), lastScale, this.rotate, lastRotateAngle, this.polygon, lastPolygon));
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlAnyChanging(new DUIControlAnyChangingEventArgs(this, new RectangleF(this.x, this.y, this.width, this.height), lastBounds, new PointF(this.centerX, this.centerY), lastCenter, new PointF(this.skewX, this.skewY), lastSkew, new PointF(this.scaleX, this.scaleY), lastScale, this.rotate, lastRotateAngle));
                }
            }
        }
Пример #4
0
        protected internal virtual void UpdateBoundsChanged(float x, float y, float width, float height, float centerX, float centerY, float rotateAngle, float skewX, float skewY, float scaleX, float scaleY, PointF[] polygon)
        {
            bool newLocation    = this.mouseDownBounds.X != x || this.mouseDownBounds.Y != y;
            bool newSize        = this.mouseDownBounds.Width != width || this.mouseDownBounds.Height != height;
            bool newCenter      = this.mouseDownCenter.X != centerX || this.mouseDownCenter.Y != centerY;
            bool newSkew        = this.mouseDownSkew.X != skewX || this.mouseDownSkew.Y != skewY;
            bool newScale       = this.mouseDownScale.X != scaleX || this.mouseDownScale.Y != scaleY;
            bool newRotateAngle = this.mouseDownRotateAngle != rotateAngle;
            bool newPolygon     = !PolygonTools.PolygonEquels(this.mouseDownPolygon, polygon);

            this.x       = x;
            this.y       = y;
            this.width   = width;
            this.height  = height;
            this.centerX = centerX;
            this.centerY = centerY;
            this.rotate  = rotateAngle;
            this.skewX   = skewX;
            this.skewY   = skewY;
            this.scaleX  = scaleX;
            this.scaleY  = scaleY;
            this.polygon = polygon.ToArray();
            if (newLocation || newSize || newCenter || newSkew || newScale || newRotateAngle || newPolygon)
            {
                this.Invalidate();
            }
            if (newLocation)
            {
                OnLocationChanged(EventArgs.Empty);
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlLocationChanged(new DUIControlEventArgs(this));
                }
            }
            if (newSize)
            {
                OnResize(EventArgs.Empty);
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlSizeChanged(new DUIControlEventArgs(this));
                }
            }
            if (newLocation || newSize)
            {
                OnBoundsChanged(EventArgs.Empty);
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlBoundsChanged(new DUIControlEventArgs(this));
                }
            }
            if (newCenter)
            {
                OnCenterChanged(EventArgs.Empty);
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlCenterChanged(new DUIControlEventArgs(this));
                }
            }
            if (newSkew)
            {
                OnSkewChanged(EventArgs.Empty);
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlSkewChanged(new DUIControlEventArgs(this));
                }
            }
            if (newScale)
            {
                OnScaleChanged(EventArgs.Empty);
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlScaleChanged(new DUIControlEventArgs(this));
                }
            }
            if (newRotateAngle)
            {
                OnRotateAngleChanged(EventArgs.Empty);
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlRotateAngleChanged(new DUIControlEventArgs(this));
                }
            }
            if (newPolygon)
            {
                OnPolygonChanged(EventArgs.Empty);
            }
            if (newLocation || newSize || newCenter || newSkew || newScale || newRotateAngle || newPolygon)
            {
                OnPolygonAnyChanged(EventArgs.Empty);
                if (this.DUIParent != null)
                {
                    this.DUIParent.OnControlAnyChanged(new DUIControlEventArgs(this));
                }
            }
        }