Class BrushInfo
Holds information on how to fill the background of a window or grid cell.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.WinForms.Core
Assembly: Syncfusion.Shared.Base.dll
Syntax
public sealed class BrushInfo : ICloneable, ISerializable, IXmlSerializable, IDisposable
Remarks
BrushInfo lets you specify a solid back color, gradient or pattern style with both back and fore color.
This information can be persisted with serialization.
You can also convert the information to a string and recreate it from a string.
BrushInfo is immutable (just like System.String). You cannot change its values. Instead you have to create a new BrushInfo object.
BrushInfo can also be persisted into code when used as a property in a component designer.
Constructors
BrushInfo()
Initializes a new instance of the BrushInfo class.
Declaration
public BrushInfo()
BrushInfo(BrushInfo)
Initializes a new instance of the BrushInfo class and copies its information from a given BrushInfo.
Declaration
public BrushInfo(BrushInfo brush)
Parameters
Type | Name | Description |
---|---|---|
BrushInfo | brush |
BrushInfo(BrushStyle, Object, Color, Color)
Initializes a new instance of the BrushInfo class with any BrushStyle. Internal only.
Declaration
public BrushInfo(BrushStyle style, object styleInfo, Color foreColor, Color backColor)
Parameters
Type | Name | Description |
---|---|---|
BrushStyle | style | The style. |
System.Object | styleInfo | The style Info. |
System.Drawing.Color | foreColor | The fore Color. |
System.Drawing.Color | backColor | The back Color. |
BrushInfo(GradientStyle, BrushInfoColorList)
Initializes a new instance of the BrushInfo class with a gradient style and gradient fill colors.
Declaration
public BrushInfo(GradientStyle gradientStyle, BrushInfoColorList colors)
Parameters
Type | Name | Description |
---|---|---|
GradientStyle | gradientStyle | |
BrushInfoColorList | colors | List of gradient fill colors. |
BrushInfo(GradientStyle, Color, Color)
Initializes a new instance of the BrushInfo class with a gradient style and gradient fill colors.
Declaration
public BrushInfo(GradientStyle gradientStyle, Color foreColor, Color backColor)
Parameters
Type | Name | Description |
---|---|---|
GradientStyle | gradientStyle | A PatternStyle. |
System.Drawing.Color | foreColor | A System.Drawing.Color used for fore color of the gradient fill. |
System.Drawing.Color | backColor | A System.Drawing.Color used for back color the gradient fill. |
BrushInfo(GradientStyle, Color[])
Initializes a new instance of the BrushInfo class with a hatch style and pattern colors.
Declaration
public BrushInfo(GradientStyle gradientStyle, Color[] colors)
Parameters
Type | Name | Description |
---|---|---|
GradientStyle | gradientStyle | |
System.Drawing.Color[] | colors | List of colors. |
BrushInfo(PatternStyle, BrushInfoColorList)
Initializes a new instance of the BrushInfo class with a hatch style and pattern colors.
Declaration
public BrushInfo(PatternStyle patternStyle, BrushInfoColorList colors)
Parameters
Type | Name | Description |
---|---|---|
PatternStyle | patternStyle | A PatternStyle value. |
BrushInfoColorList | colors | List of colors. |
BrushInfo(PatternStyle, Color, Color)
Initializes a new instance of the BrushInfo class with a hatch style and pattern colors.
Declaration
public BrushInfo(PatternStyle patternStyle, Color foreColor, Color backColor)
Parameters
Type | Name | Description |
---|---|---|
PatternStyle | patternStyle | A PatternStyle. |
System.Drawing.Color | foreColor | A System.Drawing.Color used for fore color of the pattern. |
System.Drawing.Color | backColor | A System.Drawing.Color used for back color the pattern. |
BrushInfo(PatternStyle, Color[])
Initializes a new instance of the BrushInfo class with a hatch style and pattern colors.
Declaration
public BrushInfo(PatternStyle patternStyle, Color[] colors)
Parameters
Type | Name | Description |
---|---|---|
PatternStyle | patternStyle | A PatternStyle. |
System.Drawing.Color[] | colors | List of colors. |
BrushInfo(Color)
Initializes a new instance of the BrushInfo class with the specified solid back color.
Declaration
public BrushInfo(Color color)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | A System.Drawing.Color used as solid background. |
BrushInfo(Color, Color)
Initializes a new instance of the BrushInfo class with a solid back color and fore color.
Declaration
public BrushInfo(Color foreColor, Color backColor)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | foreColor | The fore Color. |
System.Drawing.Color | backColor | The back Color. |
BrushInfo(Int32, BrushInfo)
Initializes a new instance of the BrushInfo class with a new alpha-blend value and copies other information from a given BrushInfo.
Declaration
public BrushInfo(int alpha, BrushInfo br)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | alpha | The alpha value that should be applied to the fore color and back color of the new brush. |
BrushInfo | br |
Properties
BackColor
Gets the back color.
Declaration
public Color BackColor { get; }
Property Value
Type |
---|
System.Drawing.Color |
BrushInfoColorList
Gets the colors list.The first entry in this list will be the same as the back color property, the last entry will be same as the fore color property.
Declaration
public BrushInfoColorList BrushInfoColorList { get; }
Property Value
Type | Description |
---|---|
BrushInfoColorList | A reference to the BrushInfoColorList instance. |
Empty
Gets a empty BrushInfo.
Declaration
public static BrushInfo Empty { get; }
Property Value
Type |
---|
BrushInfo |
ForeColor
Gets the fore color value.
Declaration
public Color ForeColor { get; }
Property Value
Type |
---|
System.Drawing.Color |
GradientStyle
Gets the gradient style.
Declaration
public GradientStyle GradientStyle { get; }
Property Value
Type |
---|
GradientStyle |
IsEmpty
Gets a value indicating whether a brush is an empty object.
Declaration
public bool IsEmpty { get; }
Property Value
Type |
---|
System.Boolean |
PatternStyle
Gets the pattern style.
Declaration
public PatternStyle PatternStyle { get; }
Property Value
Type |
---|
PatternStyle |
Style
Gets the brush style information (solid, gradient or pattern).
Declaration
public BrushStyle Style { get; }
Property Value
Type |
---|
BrushStyle |
Methods
ClearColorInfo()
Clears the BrushInfoColorList information.
Declaration
public void ClearColorInfo()
Clone()
Creates a new object that is a copy of the current instance.
Declaration
public BrushInfo Clone()
Returns
Type | Description |
---|---|
BrushInfo | A new object that is a copy of this instance. |
Dispose()
Clean up any resources being used.
Declaration
public void Dispose()
Parse(String)
Creates a new BrushInfo object and initializes it from a string.
Declaration
public static BrushInfo Parse(string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | A string in the format BrushStyle;Style;ForeColor;BackColor. |
Returns
Type | Description |
---|---|
BrushInfo | A new BrushInfo object. |
ToString()
Overloaded. Returns the string representation of the brush in the format BrushStyle;Style;ForeColor;BackColor.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | The System.String value. |
Overrides
ToString(String)
Returns the string representation of the brush in the format BrushStyle;Style;ForeColor;BackColor.
Declaration
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | Specifies the format for string. NULL for default, "compact" for a compact string, "G" for more descriptive text. |
Returns
Type | Description |
---|---|
System.String | Returns the string value. |
Explicit Interface Implementations
ICloneable.Clone()
Creates a new object that is a copy of this instance.
Declaration
object ICloneable.Clone()
Returns
Type | Description |
---|---|
System.Object | The copy of this will be return. |
ISerializable.GetObjectData(SerializationInfo, StreamingContext)
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
Declaration
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | The System.Runtime.Serialization.SerializationInfo to populate with data. |
System.Runtime.Serialization.StreamingContext | context | The destination for this serialization. |