Пример #1
0
        protected override bool PerformPaintTransformation(ref RadMatrix matrix)
        {
            bool  flag           = false;
            float angleTransform = this.AngleTransform;

            if ((double)angleTransform != 0.0)
            {
                flag = true;
                RectangleF bounds = new RectangleF(PointF.Empty, (SizeF)this.Bounds.Size);
                TelerikHelper.PerformCenteredRotation(ref matrix, bounds, angleTransform);
            }
            SizeF scaleTransform = this.ScaleTransform;

            if ((double)scaleTransform.Width > 0.0 && (double)scaleTransform.Height > 0.0 && ((double)scaleTransform.Width != 1.0 || (double)scaleTransform.Height != 1.0))
            {
                flag = true;
                matrix.Scale(scaleTransform.Width, scaleTransform.Height, MatrixOrder.Append);
            }
            SizeF positionOffset = this.PositionOffset;

            if (positionOffset != SizeF.Empty)
            {
                flag = true;
                matrix.Translate(this.RightToLeft ? -positionOffset.Width : positionOffset.Width, positionOffset.Height, MatrixOrder.Append);
            }
            return(flag);
        }
Пример #2
0
        public RectangleF GetTransformedBounds(RectangleF bounds)
        {
            RadMatrix identity = RadMatrix.Identity;

            if (this.ScaleTransform != this.defaultScaleTransform)
            {
                identity.Translate(-bounds.X, -bounds.Y, MatrixOrder.Append);
                identity.Scale(this.ScaleTransform.Width, this.ScaleTransform.Height, MatrixOrder.Append);
                identity.Translate(bounds.X, bounds.Y, MatrixOrder.Append);
            }
            if ((double)this.AngleTransform != 0.0)
            {
                SizeF sz = new SizeF(bounds.Width / 2f, bounds.Height / 2f);
                identity.RotateAt(this.AngleTransform, PointF.Add(bounds.Location, sz), MatrixOrder.Append);
                RectangleF boundingRect = TelerikHelper.GetBoundingRect(bounds, identity);
                identity.Translate(bounds.X - boundingRect.X, bounds.Y - boundingRect.Y, MatrixOrder.Append);
            }
            return(identity.TransformRectangle(bounds));
        }