using System.Drawing; using System.Windows.Forms; namespace HeuristicLab.ExperimentGeneration.DataAnalysis.Wizard.Controls { public enum EtchEdge { Top, Bottom } public partial class EtchedLine : UserControl { private Color darkColor; public Color DarkColor { get { return darkColor; } set { darkColor = value; Refresh(); } } private Color lightColor; public Color LightColor { get { return lightColor; } set { lightColor = value; Refresh(); } } private EtchEdge edge; public EtchEdge Edge { get { return edge; } set { edge = value; Refresh(); } } public EtchedLine() { InitializeComponent(); DarkColor = SystemColors.ControlDark; LightColor = SystemColors.ControlLight; SetStyle(ControlStyles.Selectable, false); } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); Brush lightBrush = new SolidBrush(LightColor); Brush darkBrush = new SolidBrush(DarkColor); Pen lightPen = new Pen(LightColor, 1); Pen darkPen = new Pen(DarkColor, 1); switch (Edge) { case EtchEdge.Top: e.Graphics.DrawLine(darkPen, 0, 0, Width, 0); e.Graphics.DrawLine(lightPen, 0, 1, Width, 1); break; case EtchEdge.Bottom: e.Graphics.DrawLine(darkPen, 0, Height - 2, Width, Height - 2); e.Graphics.DrawLine(lightPen, 0, Height - 1, Width, Height - 1); break; } } protected override void OnResize(System.EventArgs e) { base.OnResize(e); Refresh(); } } }