public void RenderBackground(Graphics g, RectangleF bounds) { BufferedGraphicsContext bufferedGraphicsContext = BufferedGraphicsManager.Current; using (BufferedGraphics bufferedGraphics = bufferedGraphicsContext.Allocate(g, Rectangle.Round(bounds))) { _renderer.RenderBackground(bufferedGraphics.Graphics, bounds); bufferedGraphics.Render(g); } }
private void PreviewForm_Paint(object sender, PaintEventArgs e) { QuoteRenderer renderer = new QuoteRenderer(new RenderSettings() { TextFont = _configSettings.TextFont, TextColor = _configSettings.TextColor, TextAlignment = (TextAlignment)_configSettings.TextAlignment, BackgroundColor = _configSettings.BackgroundColor, BackgroundImagePath = _configSettings.BackgroundImagePath, BackgroundAlignment = (BackgroundAlignment)_configSettings.BackgroundAlignment, BackgroundOpacity = _configSettings.BackgroundOpacity }); renderer.RenderBackground(e.Graphics, (sender as Form).ClientRectangle); }