using System.Drawing; namespace System.Windows.Forms { public class ControlPaint { public static void DrawVisualStyleBorder(Graphics graphics, Rectangle bounds, int dpi = 96) { if (graphics == null) { throw new ArgumentNullException("graphics"); } graphics.DrawRectangle(SystemPens.ActiveBorder, bounds); bounds.Inflate(-1, -1); if (dpi > 120) graphics.DrawRectangle(SystemPens.ActiveBorder, bounds); } public static void DrawFocusRectangle(Graphics graphics, Rectangle bounds) { // TODO? not used in FR } public static void DrawBorder3D(Graphics graphics, int x, int y, int width, int height, Border3DStyle style) { // TODO: incomplete graphics.DrawRectangle(SystemPens.ActiveBorder, x, y, width, height); } } public static class ControlPaintExt { public static void DrawVisualStyleBorder(this Control control, Graphics graphics, Rectangle bounds) { ControlPaint.DrawVisualStyleBorder(graphics, bounds, control.DeviceDpi); } } }