/// <summary>
        /// If the given rectangle isn't visible, sets scroll and scale so that the largest axis
        /// of the rectangle almost fills the client area</summary>
        /// <param name="adapter">Adapter managing transform</param>
        /// <param name="itemBounds">Rectangle to ensure visible</param>
        /// <param name="clientBounds">Client area</param>
        public static void EnsureVisible(this ITransformAdapter adapter, Rect itemBounds, Rect clientBounds)
        {
            // check rectangle is already in the visible rect
            if (clientBounds.Contains(itemBounds))
            {
                // already visible
                return;
            }

            adapter.Frame(itemBounds, clientBounds);
        }
예제 #2
0
        /// <summary>
        /// If the given rectangle isn't visible, sets scroll and scale so that the largest axis
        /// of the rectangle almost fills the client area</summary>
        /// <param name="adapter">Adapter managing transform</param>
        /// <param name="bounds">Rectangle to make visible, in Windows client coordinates</param>
        public static void EnsureVisible(this ITransformAdapter adapter, RectangleF bounds)
        {
            // check rectangle is already in the visible rect
            RectangleF clientRect = adapter.AdaptedControl.ClientRectangle;

            if (clientRect.Contains(bounds))
            {
                // already visible
                return;
            }

            adapter.Frame(bounds);
        }