Line | |
---|
1 | using System.Drawing;
|
---|
2 |
|
---|
3 | namespace HeuristicLab.Visualization {
|
---|
4 | public class Grid : WorldShape {
|
---|
5 | private Color color = Color.LightBlue;
|
---|
6 |
|
---|
7 | public override void Draw(Graphics graphics) {
|
---|
8 | ClearShapes();
|
---|
9 |
|
---|
10 | foreach (double y in AxisTicks.GetTicks(YAxis.PixelsPerInterval,
|
---|
11 | Parent.Viewport.Height,
|
---|
12 | ClippingArea.Height,
|
---|
13 | ClippingArea.Y1)) {
|
---|
14 | LineShape line = new LineShape(ClippingArea.X1, y,
|
---|
15 | ClippingArea.X2, y,
|
---|
16 | color, 1,
|
---|
17 | DrawingStyle.Dashed);
|
---|
18 | AddShape(line);
|
---|
19 | }
|
---|
20 |
|
---|
21 | foreach (double x in AxisTicks.GetTicks(XAxis.PixelsPerInterval,
|
---|
22 | Parent.Viewport.Width,
|
---|
23 | ClippingArea.Width,
|
---|
24 | ClippingArea.X1)) {
|
---|
25 | LineShape line = new LineShape(x, ClippingArea.Y1,
|
---|
26 | x, ClippingArea.Y2,
|
---|
27 | color, 1,
|
---|
28 | DrawingStyle.Dashed);
|
---|
29 | AddShape(line);
|
---|
30 | }
|
---|
31 |
|
---|
32 | LineShape lineZeroX = new LineShape(0, ClippingArea.Y1,
|
---|
33 | 0, ClippingArea.Y2,
|
---|
34 | color, 3,
|
---|
35 | DrawingStyle.Dashed);
|
---|
36 |
|
---|
37 | LineShape lineZeroY = new LineShape(ClippingArea.X1, 0,
|
---|
38 | ClippingArea.X2, 0,
|
---|
39 | color, 3,
|
---|
40 | DrawingStyle.Dashed);
|
---|
41 |
|
---|
42 | AddShape(lineZeroX);
|
---|
43 | AddShape(lineZeroY);
|
---|
44 |
|
---|
45 | base.Draw(graphics);
|
---|
46 | }
|
---|
47 |
|
---|
48 | public Color Color {
|
---|
49 | get { return color; }
|
---|
50 | set { color = value; }
|
---|
51 | }
|
---|
52 | }
|
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.