private void PictureBox_Paint(object sender, PaintEventArgs e) { Quote q; if (string.IsNullOrWhiteSpace(_configSettings.SourcePath)) { q = QuoteManager.Default; } else { QuoteManager manager = QuoteManager.Create(_configSettings.SourcePath); q = manager?.ReadRandom() ?? QuoteManager.Default; } 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.RenderText(q, e.Graphics, (sender as PictureBox).ClientRectangle); }
public void Render(Graphics g, RectangleF bounds) { _renderer.RenderText(_quote, g, bounds); }