Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/22/10 00:44:01 (14 years ago)
Author:
swagner
Message:

Sorted usings and removed unused usings in entire solution (#1094)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Utils/Styling/GradientPaintStyle.cs

    r2768 r4068  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Text;
    41using System.Drawing;
    52using System.Drawing.Drawing2D;
    63
    7 namespace Netron.Diagramming.Core
    8 {
    9     // ----------------------------------------------------------------------
     4namespace Netron.Diagramming.Core {
     5  // ----------------------------------------------------------------------
     6  /// <summary>
     7  /// The gradient paint style
     8  /// </summary>
     9  // ----------------------------------------------------------------------
     10  public partial class GradientPaintStyle :
     11      IPaintStyle,
     12      IVersion {
     13    // ------------------------------------------------------------------
    1014    /// <summary>
    11     /// The gradient paint style
     15    /// Event raised when this paint style is changed.
    1216    /// </summary>
    13     // ----------------------------------------------------------------------
    14     public partial class GradientPaintStyle :
    15         IPaintStyle,
    16         IVersion
    17     {
    18         // ------------------------------------------------------------------
    19         /// <summary>
    20         /// Event raised when this paint style is changed.
    21         /// </summary>
    22         // ------------------------------------------------------------------
    23         public event PaintStyleChangedEventHandler PaintStyleChanged;
     17    // ------------------------------------------------------------------
     18    public event PaintStyleChangedEventHandler PaintStyleChanged;
    2419
    25         #region Fields
    26        
    27         // ------------------------------------------------------------------
    28         /// <summary>
    29         /// Implementation of IVersion - the current version of
    30         /// GradientPaintStyle.
    31         /// </summary>
    32         // ------------------------------------------------------------------
    33         protected const double gradientPaintStyleVersion = 1.0;
     20    #region Fields
    3421
    35         // ------------------------------------------------------------------
    36         /// <summary>
    37         /// the Angle field.
    38         /// </summary>
    39         // ------------------------------------------------------------------
    40         private float mAngle;
     22    // ------------------------------------------------------------------
     23    /// <summary>
     24    /// Implementation of IVersion - the current version of
     25    /// GradientPaintStyle.
     26    /// </summary>
     27    // ------------------------------------------------------------------
     28    protected const double gradientPaintStyleVersion = 1.0;
    4129
    42         // ------------------------------------------------------------------
    43         /// <summary>
    44         /// the EndColor field
    45         /// </summary>
    46         // ------------------------------------------------------------------
    47         private Color mEndColor;
     30    // ------------------------------------------------------------------
     31    /// <summary>
     32    /// the Angle field.
     33    /// </summary>
     34    // ------------------------------------------------------------------
     35    private float mAngle;
    4836
    49         // ------------------------------------------------------------------
    50         /// <summary>
    51         /// the StartColor field
    52         /// </summary>
    53         // ------------------------------------------------------------------
    54         private Color mStartColor;
     37    // ------------------------------------------------------------------
     38    /// <summary>
     39    /// the EndColor field
     40    /// </summary>
     41    // ------------------------------------------------------------------
     42    private Color mEndColor;
    5543
    56         #endregion
     44    // ------------------------------------------------------------------
     45    /// <summary>
     46    /// the StartColor field
     47    /// </summary>
     48    // ------------------------------------------------------------------
     49    private Color mStartColor;
    5750
    58         #region Properties
     51    #endregion
    5952
    60         // ------------------------------------------------------------------
    61         /// <summary>
    62         /// Gets the current version.
    63         /// </summary>
    64         // ------------------------------------------------------------------
    65         public virtual double Version
    66         {
    67             get
    68             {
    69                 return gradientPaintStyleVersion;
    70             }
     53    #region Properties
     54
     55    // ------------------------------------------------------------------
     56    /// <summary>
     57    /// Gets the current version.
     58    /// </summary>
     59    // ------------------------------------------------------------------
     60    public virtual double Version {
     61      get {
     62        return gradientPaintStyleVersion;
     63      }
     64    }
     65
     66    // ------------------------------------------------------------------
     67    /// <summary>
     68    /// Gets or sets the StartColor
     69    /// </summary>
     70    // ------------------------------------------------------------------
     71    public Color StartColor {
     72      get {
     73        return mStartColor;
     74      }
     75      set {
     76        mStartColor = value;
     77        RaisePaintStyleChanged();
     78      }
     79    }
     80
     81    // ------------------------------------------------------------------
     82    /// <summary>
     83    /// Gets or sets the EndColor
     84    /// </summary>
     85    // ------------------------------------------------------------------
     86    public Color EndColor {
     87      get {
     88        return mEndColor;
     89      }
     90      set {
     91        mEndColor = value;
     92        RaisePaintStyleChanged();
     93      }
     94    }
     95
     96    // ------------------------------------------------------------------
     97    /// <summary>
     98    /// Gets or sets the Angle
     99    /// </summary>
     100    // ------------------------------------------------------------------
     101    public float Angle {
     102      get {
     103        return mAngle;
     104      }
     105      set {
     106        mAngle = value;
     107        RaisePaintStyleChanged();
     108      }
     109    }
     110    #endregion
     111
     112    #region Constructor
     113
     114    // ------------------------------------------------------------------
     115    ///<summary>
     116    ///Default constructor
     117    ///</summary>
     118    // ------------------------------------------------------------------
     119    public GradientPaintStyle(
     120        Color startColor,
     121        Color endColor,
     122        float angle) {
     123      mStartColor = startColor;
     124      mEndColor = endColor;
     125      mAngle = angle;
     126    }
     127
     128    // ------------------------------------------------------------------
     129    /// <summary>
     130    /// Initializes a new instance of the
     131    /// <see cref="T:GradientPaintStyle"/> class.
     132    /// </summary>
     133    // ------------------------------------------------------------------
     134    public GradientPaintStyle() {
     135      mStartColor = ArtPalette.RandomLowSaturationColor;
     136      mEndColor = Color.White;
     137      mAngle = -135;
     138    }
     139    #endregion
     140
     141    // ------------------------------------------------------------------
     142    /// <summary>
     143    /// Gets the brush.
     144    /// </summary>
     145    /// <param name="rectangle">The rectangle.</param>
     146    /// <returns>Brush</returns>
     147    // ------------------------------------------------------------------
     148    public Brush GetBrush(Rectangle rectangle) {
     149      if (rectangle.Equals(Rectangle.Empty)) {
     150        return new SolidBrush(mStartColor);
     151      } else {
     152        if (rectangle.Width == 0) {
     153          rectangle.Width = 1;
    71154        }
    72155
    73         // ------------------------------------------------------------------
    74         /// <summary>
    75         /// Gets or sets the StartColor
    76         /// </summary>
    77         // ------------------------------------------------------------------
    78         public Color StartColor
    79         {
    80             get
    81             {
    82                 return mStartColor;
    83             }
    84             set
    85             {
    86                 mStartColor = value;
    87                 RaisePaintStyleChanged();
    88             }
     156        if (rectangle.Height == 0) {
     157          rectangle.Height = 1;
    89158        }
     159        return new LinearGradientBrush(
     160            rectangle,
     161            mStartColor,
     162            mEndColor,
     163            mAngle,
     164            true);
     165      }
     166    }
    90167
    91         // ------------------------------------------------------------------
    92         /// <summary>
    93         /// Gets or sets the EndColor
    94         /// </summary>
    95         // ------------------------------------------------------------------
    96         public Color EndColor
    97         {
    98             get
    99             {
    100                 return mEndColor;
    101             }
    102             set
    103             {
    104                 mEndColor = value;
    105                 RaisePaintStyleChanged();
    106             }
    107         }
    108 
    109         // ------------------------------------------------------------------
    110         /// <summary>
    111         /// Gets or sets the Angle
    112         /// </summary>
    113         // ------------------------------------------------------------------
    114         public float Angle
    115         {
    116             get
    117             {
    118                 return mAngle;
    119             }
    120             set
    121             {
    122                 mAngle = value;
    123                 RaisePaintStyleChanged();
    124             }
    125         }
    126         #endregion
    127 
    128         #region Constructor
    129 
    130         // ------------------------------------------------------------------
    131         ///<summary>
    132         ///Default constructor
    133         ///</summary>
    134         // ------------------------------------------------------------------
    135         public GradientPaintStyle(
    136             Color startColor,
    137             Color endColor,
    138             float angle)
    139         {
    140             mStartColor = startColor;
    141             mEndColor = endColor;
    142             mAngle = angle;
    143         }
    144 
    145         // ------------------------------------------------------------------
    146         /// <summary>
    147         /// Initializes a new instance of the
    148         /// <see cref="T:GradientPaintStyle"/> class.
    149         /// </summary>
    150         // ------------------------------------------------------------------
    151         public GradientPaintStyle()
    152         {
    153             mStartColor = ArtPalette.RandomLowSaturationColor;
    154             mEndColor = Color.White;
    155             mAngle = -135;
    156         }
    157         #endregion
    158 
    159         // ------------------------------------------------------------------
    160         /// <summary>
    161         /// Gets the brush.
    162         /// </summary>
    163         /// <param name="rectangle">The rectangle.</param>
    164         /// <returns>Brush</returns>
    165         // ------------------------------------------------------------------
    166         public Brush GetBrush(Rectangle rectangle)
    167         {
    168             if (rectangle.Equals(Rectangle.Empty))
    169             {
    170                 return new SolidBrush(mStartColor);
    171             }
    172             else
    173             {
    174                 if (rectangle.Width == 0)
    175                 {
    176                     rectangle.Width = 1;
    177                 }
    178 
    179                 if (rectangle.Height == 0)
    180                 {
    181                     rectangle.Height = 1;
    182                 }
    183                 return new LinearGradientBrush(
    184                     rectangle,
    185                     mStartColor,
    186                     mEndColor,
    187                     mAngle,
    188                     true);
    189             }
    190         }
    191 
    192         // ------------------------------------------------------------------
    193         /// <summary>
    194         /// Raises the PaintStyleChanged event.
    195         /// </summary>
    196         // ------------------------------------------------------------------
    197         protected virtual void RaisePaintStyleChanged()
    198         {
    199             if (this.PaintStyleChanged != null)
    200             {
    201                 // Raise the event
    202                 this.PaintStyleChanged(
    203                     this,
    204                     new PaintStyleChangedEventArgs(
    205                     this,
    206                     FillType.LinearGradient));
    207             }
    208         }
     168    // ------------------------------------------------------------------
     169    /// <summary>
     170    /// Raises the PaintStyleChanged event.
     171    /// </summary>
     172    // ------------------------------------------------------------------
     173    protected virtual void RaisePaintStyleChanged() {
     174      if (this.PaintStyleChanged != null) {
     175        // Raise the event
     176        this.PaintStyleChanged(
     177            this,
     178            new PaintStyleChangedEventArgs(
     179            this,
     180            FillType.LinearGradient));
     181      }
    209182    }
     183  }
    210184}
Note: See TracChangeset for help on using the changeset viewer.