protected override Size ArrangeOverride(Size finalSize)
        {
            Size desiredSize = LayoutRoot.DesiredSize;

            m_rootScaleTransform.ScaleX = finalSize.Width / desiredSize.Width;
            m_rootScaleTransform.ScaleY = finalSize.Height / desiredSize.Height;

            Rect originalPosition = new Rect(0, 0, desiredSize.Width, desiredSize.Height);

            LayoutRoot.Arrange(originalPosition);

            return(finalSize);
        }
예제 #2
0
        protected override Size ArrangeOverride(Size finalSize)
        {
            if (LayoutRoot != null)
            {
                Size desiredSize = LayoutRoot.DesiredSize;
                Size scaleSize   = CalculateScaleSize(finalSize, desiredSize);

                _layoutRootScale.ScaleX = scaleSize.Width;
                _layoutRootScale.ScaleY = scaleSize.Height;

                var originalPosition = new Rect(0, 0, desiredSize.Width, desiredSize.Height);
                LayoutRoot.Arrange(originalPosition);

                finalSize.Width  = scaleSize.Width * desiredSize.Width;
                finalSize.Height = scaleSize.Height * desiredSize.Height;
            }
            return(finalSize);
        }
예제 #3
0
        public ExtendedImage GetImg(bool saveneeded, DateTime printDatum)
        {
            GenerateReport(saveneeded, printDatum);
            LayoutRoot.Measure(new Size(797, 1123));
            LayoutRoot.Arrange(new Rect(0.0, 0.0, 797, 1123));
            LayoutRoot.UpdateLayout();

            //while (!imageloaded)
            //{
            //    System.Threading.Thread.Sleep(500);
            //}
            var wb = new WriteableBitmap(2391, 3369);

            wb.Render(LayoutRoot, new ScaleTransform {
                ScaleX = 3, ScaleY = 3
            });
            wb.Invalidate();
            ExtendedImage myImage = wb.ToImage();

            exImg = myImage;
            return(exImg);
        }