public VerticalBackgroundWindow(Form sender) { InitializeComponent(); parent = sender; setLang(); context = BufferedGraphicsManager.Current; buffer = context.Allocate(resultPictureBox.CreateGraphics(), resultPictureBox.DisplayRectangle); bParams = new BackgroundParams(1080, 1920, pattern, Color.DarkCyan, 10, 55, 10, 95, -3, 10); }
public static void render(BackgroundParams p, BufferedGraphics buffer) { buffer.Graphics.Clear(p.backColor); Bitmap rPattern = new Bitmap(p.pattern, perSz(p.pattern.Size, p.patternSize)); for (int y = 0; y < p.vQ; y++) { for (int x = 0; x < p.hQ; x++) { if (y % 2 == 0) { buffer.Graphics.DrawImage(rPattern, new Point(x * p.hGap, y * p.vGap)); } else { buffer.Graphics.DrawImage(rPattern, new Point(x * p.hGap + ( int )map(p.rGap, 100, p.w), y * p.vGap)); } } } buffer.Render(); }