[7803] | 1 | using System.Drawing;
|
---|
| 2 | using System.Windows.Forms;
|
---|
| 3 |
|
---|
| 4 | namespace HeuristicLab.ExperimentGeneration.DataAnalysis.Wizard.Controls {
|
---|
| 5 | public enum EtchEdge {
|
---|
| 6 | Top,
|
---|
| 7 | Bottom
|
---|
| 8 | }
|
---|
| 9 |
|
---|
| 10 | public partial class EtchedLine : UserControl {
|
---|
| 11 | private Color darkColor;
|
---|
| 12 | public Color DarkColor {
|
---|
| 13 | get { return darkColor; }
|
---|
| 14 | set {
|
---|
| 15 | darkColor = value;
|
---|
| 16 | Refresh();
|
---|
| 17 | }
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | private Color lightColor;
|
---|
| 21 | public Color LightColor {
|
---|
| 22 | get { return lightColor; }
|
---|
| 23 | set {
|
---|
| 24 | lightColor = value;
|
---|
| 25 | Refresh();
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | private EtchEdge edge;
|
---|
| 30 | public EtchEdge Edge {
|
---|
| 31 | get { return edge; }
|
---|
| 32 | set {
|
---|
| 33 | edge = value;
|
---|
| 34 | Refresh();
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | public EtchedLine() {
|
---|
| 39 | InitializeComponent();
|
---|
| 40 | DarkColor = SystemColors.ControlDark;
|
---|
| 41 | LightColor = SystemColors.ControlLight;
|
---|
| 42 | SetStyle(ControlStyles.Selectable, false);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | protected override void OnPaint(PaintEventArgs e) {
|
---|
| 46 | base.OnPaint(e);
|
---|
| 47 | Brush lightBrush = new SolidBrush(LightColor);
|
---|
| 48 | Brush darkBrush = new SolidBrush(DarkColor);
|
---|
| 49 | Pen lightPen = new Pen(LightColor, 1);
|
---|
| 50 | Pen darkPen = new Pen(DarkColor, 1);
|
---|
| 51 |
|
---|
| 52 | switch (Edge) {
|
---|
| 53 | case EtchEdge.Top:
|
---|
| 54 | e.Graphics.DrawLine(darkPen, 0, 0, Width, 0);
|
---|
| 55 | e.Graphics.DrawLine(lightPen, 0, 1, Width, 1);
|
---|
| 56 | break;
|
---|
| 57 | case EtchEdge.Bottom:
|
---|
| 58 | e.Graphics.DrawLine(darkPen, 0, Height - 2, Width, Height - 2);
|
---|
| 59 | e.Graphics.DrawLine(lightPen, 0, Height - 1, Width, Height - 1);
|
---|
| 60 | break;
|
---|
| 61 | }
|
---|
| 62 | }
|
---|
| 63 | protected override void OnResize(System.EventArgs e) {
|
---|
| 64 | base.OnResize(e);
|
---|
| 65 | Refresh();
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
| 68 | }
|
---|