Example #1
0
 public DUICaptionContainerAlpha(DUISkinFormAlpha owner)
 {
     this.owner             = owner;
     this.lastClientSize    = this.Size;
     this.dUIControlShare   = new DUIControlShare();
     synchronizationContext = SynchronizationContext.Current;
     #region 窗体事件
     this.owner.HandleCreated += (s, e) =>
     {
         this.DoHandleCreated(e);
         LayoutEngine.DoLayout(new DUILayoutEventArgs(this, "HandleCreated"));
     };
     this.owner.Resize += (s, e) => { this.DoResize(e); };
     this.owner.Layout += (s, e) =>
     {
         if (this.Width != 0 || this.Height != 0)
         {
             if (this.lastClientSize != this.Size)
             {
                 LayoutEngine.DoLayoutDock(new DUILayoutEventArgs(this, "Layout"), this.lastClientSize);
                 this.lastClientSize = this.Size;
             }
         }
         this.DoLayout(new DUILayoutEventArgs(this, "Layout"));
     };
     #endregion
     this.Owner.Load += (s, e) =>
     {
         //记录坐标和尺寸
         this.Owner.lastSysCommandLocation = this.owner.Location;
         this.Owner.lastSysCommandSize     = this.owner.Size;
     };
     this.Owner.ResizeEnd += (s, e) =>
     {
         if (this.Owner.WindowState == FormWindowState.Normal)
         {
             //记录坐标和尺寸
             this.Owner.lastSysCommandLocation = this.owner.Location;
             this.Owner.lastSysCommandSize     = this.owner.Size;
         }
     };
 }
Example #2
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));
                }
            }
        }