/// <summary> /// Raised when the form is painted /// </summary> /// <param name="e"></param> protected override void OnPaint(PaintEventArgs e) { using (var buffer = new Bitmap(Bounds.Width, Bounds.Height)) { using (var g = GraphicsEx.FromImage(buffer)) { g.GradientFill( Bounds, Color.DarkBlue, Color.LightBlue, GradientFillDirection.Vertical); using (var font = FontFactory.CreateRotatedFont(Font.Name, 50)) { var size = g.Surface.MeasureString(Text, font); var x = (Bounds.Width - size.Width) / 2f; using (var brush = new SolidBrush(ForeColor)) g.Surface.DrawString(Text, font, brush, x, Dpi.Scale(5)); } } e.Graphics.DrawImage(buffer, 0, 0); } }