Class Fill
A class that encapsulates color-fill properties for an object. The Fill class is used in Rect, Rect, Legend, Bar, and Line objects.
Inherited Members
Namespace: ZedGraph
Assembly: ZedGraph.dll
Syntax
[Serializable]
public class Fill : ISerializable, ICloneable
Constructors
| Improve this Doc View SourceFill()
The default constructor. Initialized to no fill.
Declaration
public Fill()
Fill(Brush)
Constructor that creates a Brush fill, using a user-supplied, custom Brush. The brush will be scaled to fit the destination screen object unless you manually change IsScaled to false;
Declaration
public Fill(Brush brush)
Parameters
Type | Name | Description |
---|---|---|
Brush | brush | The Brush to use for fancy fills. Typically, this would be a LinearGradientBrush or a TextureBrush class |
Fill(Brush, Boolean)
Constructor that creates a Brush fill, using a user-supplied, custom
Brush. The brush will be scaled to fit the destination screen object
according to the
Declaration
public Fill(Brush brush, bool isScaled)
Parameters
Type | Name | Description |
---|---|---|
Brush | brush | The Brush to use for fancy fills. Typically, this would be a LinearGradientBrush or a TextureBrush class |
Boolean | isScaled | Determines if the brush will be scaled to fit the bounding box of the destination object. true to scale it, false to leave it unscaled |
Fill(Brush, AlignH, AlignV)
Constructor that creates a Brush fill, using a user-supplied, custom
Brush. This constructor will make the brush unscaled (see IsScaled),
but it provides
Declaration
public Fill(Brush brush, AlignH alignH, AlignV alignV)
Parameters
Type | Name | Description |
---|---|---|
Brush | brush | The Brush to use for fancy fills. Typically, this would be a LinearGradientBrush or a TextureBrush class |
AlignH | alignH | Controls the horizontal alignment of the brush within the filled object (see AlignH |
AlignV | alignV | Controls the vertical alignment of the brush within the filled object (see AlignV |
Fill(Color)
Constructor that creates a solid color-fill, setting Type to Solid, and setting Color to the specified color value.
Declaration
public Fill(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color of the solid fill |
Fill(Color, Brush, FillType)
Constructor that specifies the color, brush, and type for this fill.
Declaration
public Fill(Color color, Brush brush, FillType type)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color of the fill for solid fills |
Brush | brush | A custom brush for fills. Can be a SolidBrush, LinearGradientBrush, or TextureBrush. |
FillType | type | The FillType for this fill. |
Fill(Color, Color)
Constructor that creates a linear gradient color-fill, setting Type to Brush using the specified colors.
Declaration
public Fill(Color color1, Color color2)
Parameters
Type | Name | Description |
---|---|---|
Color | color1 | The first color for the gradient fill |
Color | color2 | The second color for the gradient fill |
Fill(Color, Color, Color)
Constructor that creates a linear gradient color-fill, setting Type to Brush using the specified colors. This gradient fill consists of three colors.
Declaration
public Fill(Color color1, Color color2, Color color3)
Parameters
Type | Name | Description |
---|---|---|
Color | color1 | The first color for the gradient fill |
Color | color2 | The second color for the gradient fill |
Color | color3 | The third color for the gradient fill |
Fill(Color, Color, Color, Single)
Constructor that creates a linear gradient color-fill, setting Type to Brush using the specified colors. This gradient fill consists of three colors
Declaration
public Fill(Color color1, Color color2, Color color3, float angle)
Parameters
Type | Name | Description |
---|---|---|
Color | color1 | The first color for the gradient fill |
Color | color2 | The second color for the gradient fill |
Color | color3 | The third color for the gradient fill |
Single | angle | The angle (degrees) of the gradient fill |
Fill(Color, Color, Single)
Constructor that creates a linear gradient color-fill, setting Type to Brush using the specified colors and angle.
Declaration
public Fill(Color color1, Color color2, float angle)
Parameters
Type | Name | Description |
---|---|---|
Color | color1 | The first color for the gradient fill |
Color | color2 | The second color for the gradient fill |
Single | angle | The angle (degrees) of the gradient fill |
Fill(Color[])
Constructor that creates a linear gradient multi-color-fill, setting Type to
Brush using the specified colors. This gradient fill
consists of many colors based on an array of Color objects, drawn at an
angle of zero (degrees). The
Declaration
public Fill(Color[] colors)
Parameters
Type | Name | Description |
---|---|---|
Color[] | colors | The array of Color objects that defines the colors along the gradient. |
Fill(Color[], Single)
Constructor that creates a linear gradient multi-color-fill, setting Type to
Brush using the specified colors. This gradient fill
consists of many colors based on an array of Color objects, drawn at the
specified angle (degrees). The
Declaration
public Fill(Color[] colors, float angle)
Parameters
Type | Name | Description |
---|---|---|
Color[] | colors | The array of Color objects that defines the colors along the gradient. |
Single | angle | The angle (degrees) of the gradient fill |
Fill(Color[], Single[])
Constructor that creates a linear gradient multi-color-fill, setting Type to
Brush using the specified colors. This gradient fill
consists of many colors based on an array of Color objects, drawn at the
an angle of zero (degrees). The
Declaration
public Fill(Color[] colors, float[] positions)
Parameters
Type | Name | Description |
---|---|---|
Color[] | colors | The array of Color objects that defines the colors along the gradient. |
Single[] | positions | The array of floating point values that defines the color positions along the gradient. Values should range from 0 to 1. |
Fill(Color[], Single[], Single)
Constructor that creates a linear gradient multi-color-fill, setting Type to
Brush using the specified colors. This gradient fill
consists of many colors based on an array of Color objects, drawn at the
specified angle (degrees). The
Declaration
public Fill(Color[] colors, float[] positions, float angle)
Parameters
Type | Name | Description |
---|---|---|
Color[] | colors | The array of Color objects that defines the colors along the gradient. |
Single[] | positions | The array of floating point values that defines the color positions along the gradient. Values should range from 0 to 1. |
Single | angle | The angle (degrees) of the gradient fill |
Fill(ColorBlend)
Constructor that creates a linear gradient multi-color-fill, setting Type to Brush using the specified colors. This gradient fill consists of many colors based on a ColorBlend object. The gradient angle is defaulted to zero.
Declaration
public Fill(ColorBlend blend)
Parameters
Type | Name | Description |
---|---|---|
ColorBlend | blend | The ColorBlend object that defines the colors and positions along the gradient. |
Fill(ColorBlend, Single)
Constructor that creates a linear gradient multi-color-fill, setting Type to Brush using the specified colors. This gradient fill consists of many colors based on a ColorBlend object, drawn at the specified angle (degrees).
Declaration
public Fill(ColorBlend blend, float angle)
Parameters
Type | Name | Description |
---|---|---|
ColorBlend | blend | The ColorBlend object that defines the colors and positions along the gradient. |
Single | angle | The angle (degrees) of the gradient fill |
Fill(Image, WrapMode)
Declaration
public Fill(Image image, WrapMode wrapMode)
Parameters
Type | Name | Description |
---|---|---|
Image | image | The Image to use for filling |
WrapMode | wrapMode | The WrapMode class that controls the image wrapping properties |
Fill(SerializationInfo, StreamingContext)
Constructor for deserializing objects
Declaration
protected Fill(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
SerializationInfo | info | A SerializationInfo instance that defines the serialized data |
StreamingContext | context | A StreamingContext instance that contains the serialized data |
Fill(Fill)
The Copy Constructor
Declaration
public Fill(Fill rhs)
Parameters
Type | Name | Description |
---|---|---|
Fill | rhs | The Fill object from which to copy |
Fields
| Improve this Doc View Source_brush
Private field that stores the custom fill brush. Use the public property Brush to access this value. This property is only applicable if the Type property is set to Brush.
Declaration
[CLSCompliant(false)]
protected Brush _brush
Field Value
Type | Description |
---|---|
Brush |
schema
Current schema value that defines the version of the serialized file
Declaration
public const int schema = 10
Field Value
Type | Description |
---|---|
Int32 |
Properties
| Improve this Doc View SourceAlignH
Determines how the brush will be aligned with the filled object in the horizontal direction. This value is a AlignH enumeration. This field only applies if IsScaled is false.
Declaration
public AlignH AlignH { get; set; }
Property Value
Type | Description |
---|---|
AlignH |
See Also
| Improve this Doc View SourceAlignV
Determines how the brush will be aligned with the filled object in the vertical direction. This value is a AlignV enumeration. This field only applies if IsScaled is false.
Declaration
public AlignV AlignV { get; set; }
Property Value
Type | Description |
---|---|
AlignV |
See Also
| Improve this Doc View SourceBrush
The custom fill brush. This can be a SolidBrush, a LinearGradientBrush, or a TextureBrush. This property is only applicable if the Type property is set to Brush.
Declaration
public Brush Brush { get; set; }
Property Value
Type | Description |
---|---|
Brush |
Color
The fill color. This property is used as a single color to make a solid fill (Type is Solid), or it can be used in combination with White to make a LinearGradientBrush when Type is Brush and Brush is null.
Declaration
public Color Color { get; set; }
Property Value
Type | Description |
---|---|
Color |
See Also
| Improve this Doc View SourceIsGradientValueType
Returns a boolean value indicating whether or not this fill is a "Gradient-By-Value" type. This is true for GradientByX, GradientByY, or GradientByZ.
Declaration
public bool IsGradientValueType { get; }
Property Value
Type | Description |
---|---|
Boolean | true if this is a Gradient-by-value type, false otherwise |
Remarks
The gradient by value fill method allows the fill color for each point or bar to be based on a value for that point (either X, Y, or Z in the IPointList. For example, assume a Fill class is defined with a linear gradient ranging from Blue to Red and the Type is set to GradientByY. If RangeMin is set to 100.0 and RangeMax is set to 200.0, then a point that has a Y value of 100 or less will be colored blue, a point with a Y value of 200 or more will be colored red, and a point between 100 and 200 will have a color based on a linear scale between blue and red. Note that the fill color is always solid for any given point. You can use the Z value from IPointList along with GradientByZ to color individual points according to some property that is independent of the X,Y point pair.
See Also
| Improve this Doc View SourceIsScaled
Determines if the brush will be scaled to the bounding box of the filled object. If this value is false, then the brush will only be aligned with the filled object based on the AlignH and AlignV properties.
Declaration
public bool IsScaled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsVisible
This property determines the type of color fill. Returns true if the Type property is either Solid or Brush. If set to true, this property will automatically set the Type to Brush. If set to false, this property will automatically set the Type to None. In order to get a regular solid-color fill, you have to manually set Type to Solid.
Declaration
public bool IsVisible { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
| Improve this Doc View SourceRangeDefault
The default user-scale value for the gradient-by-value determination. This defines the value that will be used when there is no point value available, or the actual point value is invalid.
Declaration
public double RangeDefault { get; set; }
Property Value
Type | Description |
---|---|
Double | A double value, in user scale unit |
Remarks
Note that this value, when defined, will determine the color that is used in the legend. If this value is set to double.MaxValue, then it remains "undefined." In this case, the legend symbols will actually be filled with a color gradient representing the range of colors.
See Also
| Improve this Doc View SourceRangeMax
The maximum user-scale value for the gradient-by-value determination. This defines the user-scale value for the end of the gradient.
Declaration
public double RangeMax { get; set; }
Property Value
Type | Description |
---|---|
Double | A double value, in user scale unit |
See Also
| Improve this Doc View SourceRangeMin
The minimum user-scale value for the gradient-by-value determination. This defines the user-scale value for the start of the gradient.
Declaration
public double RangeMin { get; set; }
Property Value
Type | Description |
---|---|
Double | A double value, in user scale unit |
See Also
| Improve this Doc View SourceSecondaryValueGradientColor
Gets or sets the secondary color for gradientByValue fills.
Declaration
public Color SecondaryValueGradientColor { get; set; }
Property Value
Type | Description |
---|---|
Color |
Remarks
This property is only applicable if the Type is GradientByX, GradientByY, or GradientByZ. Once the gradient-by-value logic picks a color, a new gradient will be created using the SecondaryValueGradientColor, the resulting gradient-by-value color, and the angle setting for this Fill. Use a value of Empty to have a solid-color Fill resulting from a gradient-by-value FillType.
Type
Determines the type of fill, which can be either solid color (Solid) or a custom brush (Brush). See Type for more information.
Declaration
public FillType Type { get; set; }
Property Value
Type | Description |
---|---|
FillType |
See Also
Methods
| Improve this Doc View SourceClone()
Typesafe, deep-copy clone method.
Declaration
public Fill Clone()
Returns
Type | Description |
---|---|
Fill | A new, independent copy of this class |
Draw(Graphics, RectangleF)
Fill the background of the RectangleF area, using the fill type from this Fill.
Declaration
public void Draw(Graphics g, RectangleF rect)
Parameters
Type | Name | Description |
---|---|---|
Graphics | g | A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. |
RectangleF | rect | The RectangleF struct specifying the area to be filled |
Draw(Graphics, RectangleF, PointPair)
Fill the background of the RectangleF area, using the fill type from this Fill.
Declaration
public void Draw(Graphics g, RectangleF rect, PointPair pt)
Parameters
Type | Name | Description |
---|---|---|
Graphics | g | A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. |
RectangleF | rect | The RectangleF struct specifying the area to be filled |
PointPair | pt | The data value to be used in case it's a GradientByX, GradientByY, or GradientByZ FillType. |
GetObjectData(SerializationInfo, StreamingContext)
Populates a SerializationInfo instance with the data needed to serialize the target object
Declaration
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
SerializationInfo | info | A SerializationInfo instance that defines the serialized data |
StreamingContext | context | A StreamingContext instance that contains the serialized data |
MakeBrush(RectangleF)
Create a fill brush using current properties. This method will construct a brush based on the settings of Type, Color and Brush. If Type is set to Brush and Brush is null, then a LinearGradientBrush will be created between the colors of White and Color.
Declaration
public Brush MakeBrush(RectangleF rect)
Parameters
Type | Name | Description |
---|---|---|
RectangleF | rect | A rectangle that bounds the object to be filled. This determines the start and end of the gradient fill. |
Returns
Type | Description |
---|---|
Brush | A Brush class representing the fill brush |
MakeBrush(RectangleF, PointPair)
Create a fill brush using current properties. This method will construct a brush based on the settings of Type, Color and Brush. If Type is set to Brush and Brush is null, then a LinearGradientBrush will be created between the colors of White and Color.
Declaration
public Brush MakeBrush(RectangleF rect, PointPair dataValue)
Parameters
Type | Name | Description |
---|---|---|
RectangleF | rect | A rectangle that bounds the object to be filled. This determines the start and end of the gradient fill. |
PointPair | dataValue | The data value to be used for a value-based color gradient. This is only applicable for GradientByX, GradientByY or GradientByZ. |
Returns
Type | Description |
---|---|
Brush | A Brush class representing the fill brush |
Explicit Interface Implementations
| Improve this Doc View SourceICloneable.Clone()
Implement the ICloneable interface in a typesafe manner by just calling the typed version of Clone()
Declaration
object ICloneable.Clone()
Returns
Type | Description |
---|---|
Object | A deep copy of this object |