public Page() { //Zoom = 100; Background = new Background(); Width = 864; Height = 1194; }
public static void DrawBackgroundStyle(Graphics g, Point location, Size size, Background background) { // draw background color g.FillRectangle( new SolidBrush(System.Drawing.Color.FromKnownColor(background.Color)), location.X, location.Y, size.Width, size.Height); // draw background image if (background.Image != null) { Image bg = background.Image; // Image.FromFile(this.Background.Image); switch (background.Repeat) { case BackgroundRepeat.Undefined: case BackgroundRepeat.Tile: for (int i = 0; i < size.Width / bg.Width; i++) for (int j = 0; j < size.Height / bg.Height; j++) g.DrawImageUnscaled(bg, location.X + i * bg.Width, location.Y + j * bg.Height); break; case BackgroundRepeat.Strech: g.DrawImage(bg, location.X, location.Y, size.Width, size.Height); break; case BackgroundRepeat.Center: int posX = location.X + size.Width / 2 - bg.Width / 2; int posY = location.Y + size.Height / 2 - bg.Height / 2; g.DrawImageUnscaled(bg, posX, posY); break; default: break; } } }
public Element() { //Color = KnownColor.Black; Background = new Background(); Border = new BorderComplex(); Padding = new MarginPadding(); }