Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataAnalysisService/HeuristicLab.ExperimentGeneration.DataAnalysis.Wizard/3.3/Controls/EtchedLine.cs @ 7803

Last change on this file since 7803 was 7803, checked in by spimming, 12 years ago

#1807:

  • data analysis service initial commit
  • wizard added
File size: 1.7 KB
Line 
1using System.Drawing;
2using System.Windows.Forms;
3
4namespace 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}
Note: See TracBrowser for help on using the repository browser.