Esempio n. 1
0
        private void AdjustImage(Skin.ElementConfig config, Image image, double xRatio, double yRatio)
        {
            uint newX = config.X = (uint)Math.Round(config.OriginalX * xRatio);
            uint newY = config.Y = (uint)Math.Round(config.OriginalY * yRatio);

            int newWidth  = (int)Math.Round(config.Width * xRatio);
            int newHeight = (int)Math.Round(config.Height * yRatio);

            image.Margin = new Thickness(newX, newY, 0, 0);
            image.Width  = newWidth;
            image.Height = newHeight;
        }
Esempio n. 2
0
        static Image getImageForElement(Skin.ElementConfig config)
        {
            var img = new Image();

            img.VerticalAlignment   = VerticalAlignment.Top;
            img.HorizontalAlignment = HorizontalAlignment.Left;
            img.Source  = config.Image;
            img.Stretch = Stretch.Fill;
            img.Margin  = new Thickness(config.X, config.Y, 0, 0);
            img.Width   = config.Width;
            img.Height  = config.Height;
            return(img);
        }
Esempio n. 3
0
        private void AdjustGrid(Skin.ElementConfig config, Grid grid, double xRatio, double yRatio)
        {
            uint newX = config.X = (uint)Math.Round(config.OriginalX * xRatio);
            uint newY = config.Y = (uint)Math.Round(config.OriginalY * yRatio);

            uint newWidth  = config.Width = (uint)Math.Round(config.OriginalWidth * xRatio);
            uint newHeight = config.Height = (uint)Math.Round(config.OriginalHeight * yRatio);

            ((Image)grid.Children[0]).Width  = newWidth;
            ((Image)grid.Children[0]).Height = newHeight;

            grid.Margin = new Thickness(newX, newY, 0, 0);
            grid.Width  = newWidth;
            grid.Height = newHeight;
        }