/// <summary>Raises the Paint event.</summary> /// <param name="pe">A PaintEventArgs that contains the event data.</param> protected override void OnPaint(PaintEventArgs pe) { // Do base painting base.OnPaint(pe); // Draw the base underlying image if (_underImage != null) { pe.Graphics.DrawImage(_underImage, 0, 0); } // Render all of the sprites if (_sprites != null && _sprites.Count > 0) { for (int i = _sprites.Count - 1; i >= 0; --i) { ImageSprite s = _sprites[i]; s.Paint(pe.Graphics); } } // Show the congratulatory text string text = ResourceHelper.PuzzleSolvedCongratulations; if (_sf != null && text != null && text.Length > 0) { float emSize = GraphicsHelpers.GetMaximumEMSize(text, pe.Graphics, Font.FontFamily, Font.Style, ClientRectangle.Width, ClientRectangle.Height); using (Font f = new Font(Font.FontFamily, emSize)) { pe.Graphics.DrawString(text, f, Brushes.Black, new RectangleF(2, 2, ClientRectangle.Width, ClientRectangle.Height), _sf); pe.Graphics.DrawString(text, f, Brushes.Gray, new RectangleF(-1, -1, ClientRectangle.Width, ClientRectangle.Height), _sf); pe.Graphics.DrawString(text, f, Brushes.Yellow, new RectangleF(0, 0, ClientRectangle.Width, ClientRectangle.Height), _sf); } } }