Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/12/08 07:15:24 (16 years ago)
Author:
dwagner
Message:

Added feature: Drawingstyle for lines; #345

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Visualization/LineShape.cs

    r870 r980  
    11using System.Drawing;
     2using System.Drawing.Drawing2D;
    23
    34namespace HeuristicLab.Visualization {
     
    78    private Color color;
    89    private int thickness;
     10    private DashStyle dashStyle;
    911
    1012    /// <summary>
     
    1618    /// <param name="y2">y coordinate of right lineEndPoind</param>
    1719    /// <param name="color">color for the LineShape</param>
    18     public LineShape(double x1, double y1, double x2, double y2, double z, Color color, int thickness) {
     20    public LineShape(double x1, double y1, double x2, double y2, double z, Color color, int thickness, DrawingStyle style) {
    1921      this.boundingBox = new RectangleD(x1, y1, x2, y2);
    2022      this.z = z;
    2123      this.color = color;
    2224      this.thickness = thickness;
     25      if (style==DrawingStyle.Dashed) {
     26        this.dashStyle = DashStyle.Dash;
     27      }
     28      else {
     29        this.dashStyle = DashStyle.Solid;        //default
     30      }
    2331    }
    2432
     
    5563    public void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
    5664      using (Pen pen = new Pen(color, thickness)){
    57         // TODO there seems to be a bug with drawing straight lines.
     65        pen.DashStyle = this.dashStyle;
    5866        Rectangle screenRect = Transform.ToScreen(boundingBox, viewport, clippingArea);
    5967        graphics.DrawLine(pen,screenRect.Left, screenRect.Bottom, screenRect.Right, screenRect.Top);
Note: See TracChangeset for help on using the changeset viewer.