Free cookie consent management tool by TermsFeed Policy Generator

source: branches/CEDMA-Refactoring-Ticket419/HeuristicLab.Visualization/RectangleShape.cs @ 978

Last change on this file since 978 was 635, checked in by mstoeger, 16 years ago

Imported charting framework sources into HeuristicLab.Visualization (#294)

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