예제 #1
0
        internal static bool IsRotated(Visual visual)
        {
            // Determine whether WindowsFormsHost is rotated
            Point  pOrigin    = HostUtils.TransformToRootPoint(visual, new Point(0.0, 0.0));
            Point  pX         = HostUtils.TransformToRootPoint(visual, new Point(1.0, 0.0));
            Point  pY         = HostUtils.TransformToRootPoint(visual, new Point(0.0, 1.0));
            Vector xComponent = pX - pOrigin;
            Vector yComponent = pY - pOrigin;

            return(xComponent.X < 0 || yComponent.Y < 0);
        }
예제 #2
0
        internal static Vector GetScale(Visual visual, out bool skewed)
        {
            // Determine whether WindowsFormsHost scaling has changed
            Point  pOrigin    = HostUtils.TransformToRootPoint(visual, new Point(0.0, 0.0));
            Point  pX         = HostUtils.TransformToRootPoint(visual, new Point(1.0, 0.0));
            Point  pY         = HostUtils.TransformToRootPoint(visual, new Point(0.0, 1.0));
            Vector xComponent = pX - pOrigin;
            Vector yComponent = pY - pOrigin;

            skewed = (!IsZero(xComponent.Y) || !IsZero(yComponent.X));

            return(new Vector(xComponent.Length, yComponent.Length));
        }