コード例 #1
0
        public static Rect RoundUpLayoutRect(BaseFrameworkElement element, Rect rect)
        {
            IPlatformGeometryHelper geometryHelper = element.Platform.GeometryHelper;
            IViewVisual             visual         = element.ViewObject as IViewVisual;

            if (geometryHelper.NeedRoundupLayoutRect(visual))
            {
                IProperty propertyKey = element.ProjectContext.ResolveProperty(Base2DElement.UseLayoutRoundingProperty);
                if (propertyKey != null && (bool)visual.GetCurrentValue(propertyKey))
                {
                    return(geometryHelper.RoundupLayoutRect(rect));
                }
            }
            return(rect);
        }
コード例 #2
0
        public static Rect GetRoundedUpChildRect(ILayoutDesigner designer, BaseFrameworkElement element)
        {
            IPlatformGeometryHelper geometryHelper = element.Platform.GeometryHelper;
            IViewVisual             visual         = element.ViewObject as IViewVisual;

            if (geometryHelper.NeedRoundupLayoutRect(visual))
            {
                using (IDisposable disposable = LayoutRoundingHelper.TurnOffLayoutRounding(element))
                {
                    if (disposable != null)
                    {
                        Rect childRect = designer.GetChildRect(element);
                        return(geometryHelper.RoundupLayoutRect(childRect));
                    }
                }
            }
            return(designer.GetChildRect(element));
        }