Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Visualization/LegendShape.cs @ 866

Last change on this file since 866 was 866, checked in by shofstad, 16 years ago

LegendShape.cs added (#407)

File size: 925 bytes
Line 
1using System.Drawing;
2
3namespace HeuristicLab.Visualization {
4  public class LegendShape : IShape {
5    private readonly Color color;
6    private readonly RectangleD rect;
7
8    public LegendShape(double x1, double y1, double x2, double y2, double z, Color color) {
9      rect = new RectangleD(x1, y1, x2, y2);
10      this.Z = z;
11      this.color = color;
12    }
13
14    public double Z { get; set; }
15
16    #region IShape Members
17
18    public RectangleD BoundingBox {
19      get { return rect; }
20    }
21
22    public void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
23      using (var pen = new Pen(color, 1))
24      using (Brush brush = new SolidBrush(color)) {
25        Rectangle screenRect = Transform.ToScreen(rect, viewport, clippingArea);
26
27        graphics.DrawRectangle(pen, screenRect);
28        graphics.FillRectangle(brush, screenRect);
29      }
30    }
31
32    #endregion
33  }
34}
Note: See TracBrowser for help on using the repository browser.