private Rectangle GetItemBounds() { IEnumerable <object> items = Dragging() ? m_draggingItems : GetItems(); Rectangle result; LayoutContexts.GetBounds(m_layoutContext, items, out result); return(result); }
/// <summary> /// Centers items in canvas at point</summary> /// <param name="items">Items to center</param> /// <param name="p">Point at which to center items, in client space</param> public void Center(IEnumerable <object> items, Point p) { // get bounds, convert to world coords Rectangle bounds; LayoutContexts.GetBounds(m_viewingContext.Cast <ILayoutContext>(), items, out bounds); Matrix transform = m_viewingContext.Cast <AdaptableControl>().Cast <ITransformAdapter>().Transform; p = GdiUtil.InverseTransform(transform, p); // convert center to world coords m_viewingContext.Cast <ILayoutContext>().Center(items, p); }