Last change
on this file since 1187 was
1038,
checked in by mstoeger, 16 years ago
|
Modified the XAxis labels so they are always visible at the bottom. (#433)
Added simple layout management to the line chart's root shape containing a title-, lines- and xaxis-area. (#345)
|
File size:
1.2 KB
|
Line | |
---|
1 | using System.Drawing;
|
---|
2 |
|
---|
3 | namespace HeuristicLab.Visualization {
|
---|
4 | public class RectangleShape : IShape {
|
---|
5 | private RectangleD rectangle;
|
---|
6 | private Color color;
|
---|
7 | private int opacity = 255;
|
---|
8 |
|
---|
9 | public RectangleShape(double x1, double y1, double x2, double y2, Color color) {
|
---|
10 | rectangle = new RectangleD(x1, y1, x2, y2);
|
---|
11 | this.color = color;
|
---|
12 | }
|
---|
13 |
|
---|
14 | public RectangleD BoundingBox {
|
---|
15 | get { return rectangle; }
|
---|
16 | }
|
---|
17 |
|
---|
18 | public void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
|
---|
19 | Color brushColor = Color.FromArgb(opacity, color);
|
---|
20 |
|
---|
21 | using (Pen pen = new Pen(color, 1))
|
---|
22 | using (Brush brush = new SolidBrush(brushColor)) {
|
---|
23 | Rectangle screenRect = Transform.ToScreen(rectangle, viewport, clippingArea);
|
---|
24 |
|
---|
25 | graphics.DrawRectangle(pen, screenRect);
|
---|
26 | graphics.FillRectangle(brush, screenRect);
|
---|
27 | }
|
---|
28 | }
|
---|
29 |
|
---|
30 | public int Opacity {
|
---|
31 | get { return opacity; }
|
---|
32 | set { opacity = value; }
|
---|
33 | }
|
---|
34 |
|
---|
35 | public RectangleD Rectangle {
|
---|
36 | get { return rectangle; }
|
---|
37 | set { rectangle = value; }
|
---|
38 | }
|
---|
39 |
|
---|
40 | public Color Color {
|
---|
41 | get { return color; }
|
---|
42 | set { color = value; }
|
---|
43 | }
|
---|
44 | }
|
---|
45 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.