Dim sf As New StringFormat() Try Select Case e.Header.TextAlign Case HorizontalAlignment.Center sf.Alignment = StringAlignment.Center Case HorizontalAlignment.Right sf.Alignment = StringAlignment.Far End Select Using brush As Brush = New SolidBrush(GroupBoxBackcolor) e.Graphics.FillRectangle(brush, e.Bounds) End Using Dim bounds As Rectangle = e.Bounds bounds.Width -= 1 bounds.Height -= 1 e.Graphics.DrawRectangle(SystemPens.ControlDark, bounds) bounds.Width -= 1 bounds.Height -= 1 ' Draw the header text. Dim headerFont As New Font("Segoe UI", 10, FontStyle.Bold) Try e.Graphics.DrawString(e.Header.Text, headerFont, _ Brushes.Blue, e.Bounds, sf) Finally headerFont.Dispose() End Try Finally sf.Dispose() End Try
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)