Class GridBorder
Defines and implements the immutable class that holds formatting information for individual borders of a cell.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public sealed class GridBorder : IFormattable, ICloneable, ISerializable, IXmlSerializable
Remarks
You can assign GridBorder objects to individual borders of a Borders object in a GridStyleInfo object.
The GridBordersInfo class lets you assign a different GridBorder to each GridBorderSide.
GridBorder is serializable and ToString and IFormattable are implemented.
Examples
The following code changes border information for cells:
GridBorder border = new GridBorder(GridBorderStyle.Solid, Color.FromArgb(57, 73, 122));
model[rowIndex, colIndex].Borders.Bottom = border;
model[rowIndex, colIndex].Borders.Right = border;
The following code hides grid lines for specific cells:
GridBorder border = new GridBorder(GridBorderStyle.None);
model[rowIndex, colIndex].Borders.Bottom = border;
model[rowIndex, colIndex].Borders.Right = border;
Constructors
GridBorder()
Initializes a new instance of the GridBorder class.
Declaration
public GridBorder()
GridBorder(GridBorderStyle)
Initializes a new instance of the GridBorder class with the specified Grid border style.
Declaration
public GridBorder(GridBorderStyle style)
Parameters
Type | Name | Description |
---|---|---|
GridBorderStyle | style | The line style to be applied to the specific border in a cell. |
GridBorder(GridBorderStyle, Color)
Initializes a new instance of the GridBorder class with the specified GridBorderStyle and System.Drawing.Color.
Declaration
public GridBorder(GridBorderStyle style, Color color)
Parameters
Type | Name | Description |
---|---|---|
GridBorderStyle | style | A GridBorderStyle to be applied to the specific border in a cell. |
System.Drawing.Color | color | A System.Drawing.Color specifying the color of the border. |
Examples
This example shows how to use the GridBorder(GridBorderStyle, Color) method.
this.gridControl1.TableStyle.Borders.All = new GridBorder(GridBorderStyle.Dotted, Color.SkyBlue);
Me.gridControl1.TableStyle.Borders.All = New GridBorder(GridBorderStyle.Dotted, Color.SkyBlue)
GridBorder(GridBorderStyle, Color, GridBorderWeight)
Initializes a new instance of the GridBorder class with the specified GridBorderStyle and System.Drawing.Color.
Declaration
public GridBorder(GridBorderStyle style, Color color, GridBorderWeight weight)
Parameters
Type | Name | Description |
---|---|---|
GridBorderStyle | style | A GridBorderStyle to be applied to the specific border in a cell. |
System.Drawing.Color | color | A System.Drawing.Color specifying the color of the border. |
GridBorderWeight | weight | A GridBorderWeight specifying the thickness of the border. |
Examples
This example shows how to use theGridBorder(GridBorderStyle, Color, GridBorderWeight) method.
this.gridControl1.TableStyle.Borders.All = new GridBorder(GridBorderStyle.Dotted, Color.SkyBlue,GridBorderWeight.ExtraThick);
Me.gridControl1.TableStyle.Borders.All = New GridBorder(GridBorderStyle.Dotted, Color.SkyBlue)
Fields
Empty
An empty GridBorder object.
Declaration
public static readonly GridBorder Empty
Field Value
Type |
---|
GridBorder |
Properties
Color
Gets the color value to be used for the cell border. This value comes from the System.Drawing.Color enumeration.
Declaration
public Color Color { get; }
Property Value
Type |
---|
System.Drawing.Color |
Info
Gets the value of ToString() method.
Declaration
public string Info { get; }
Property Value
Type |
---|
System.String |
IsEmpty
Gets a value indicating whether this GridBorder is uninitialized.
Declaration
public bool IsEmpty { get; }
Property Value
Type |
---|
System.Boolean |
Style
Gets the value of type of border line the cell has. This value comes from the GridBorderStyle enumeration.
Declaration
public GridBorderStyle Style { get; }
Property Value
Type |
---|
GridBorderStyle |
Weight
Gets the value of weight of the border the cell has. This value comes from the GridBorderWeight enumeration.
Declaration
public GridBorderWeight Weight { get; }
Property Value
Type |
---|
GridBorderWeight |
Width
Gets the value of width in pixels for the cell border.
Declaration
public int Width { get; }
Property Value
Type |
---|
System.Int32 |
Methods
Clone()
Creates an exact copy of this object.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | A GridBorder object. |
Compare(GridBorder, GridBorder)
Compares the given two objects.
Declaration
public static bool Compare(GridBorder lhs, GridBorder rhs)
Parameters
Type | Name | Description |
---|---|---|
GridBorder | lhs | The left-hand side of the operator. |
GridBorder | rhs | The right-hand side of the operator. |
Returns
Type | Description |
---|---|
System.Boolean | Boolean value. |
Equals(Object)
Overrides and determines whether the given object equals or not.
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The object to be compared. |
Returns
Type | Description |
---|---|
System.Boolean | TrueIf it is equal; False otherwise. |
Overrides
GetHashCode()
Overrides and gets the hash code for the current GridBorder instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | Hash code. |
Overrides
MakeBlackAndWhite()
Returns a copy of this border object replacing the color with System.Drawing.Color.Black.
Declaration
public GridBorder MakeBlackAndWhite()
Returns
Type | Description |
---|---|
GridBorder | A GridBorder with black color. |
Parse(String)
Creates a GridBorder from a string.
Declaration
public static GridBorder Parse(string parseStr)
Parameters
Type | Name | Description |
---|---|---|
System.String | parseStr | The string to parse. |
Returns
Type | Description |
---|---|
GridBorder | A Syncfusion.Windows.Forms.Grid.GridBorder.ReadString(System.String) that corresponds to parseStr. |
Remarks
The output from ToString() should be consumable by Parse(String).
ReadXml(XmlReader)
De-serializes the contents of this object from an XML stream.
Declaration
public void ReadXml(XmlReader reader)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlReader | reader | Represents the XML stream. |
ToString()
Overrides and returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A String that can be passed to Parse(String). |
Overrides
ToString(IFormatProvider)
Returns a string that represents the current object.
Declaration
public string ToString(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
System.IFormatProvider | provider | The Format Provider. Ignored. |
Returns
Type | Description |
---|---|
System.String | A String that can be passed to Parse(String). |
ToString(String)
Returns a string that represents the current object.
Declaration
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | "Compact" for compact text; default is full text version. |
Returns
Type | Description |
---|---|
System.String | A String that can be passed to Parse(String). |
ToString(String, IFormatProvider)
Returns a string that represents the current object.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | "Compact" for compact text; default is full text version. |
System.IFormatProvider | formatProvider | Format Provider. Ignored. |
Returns
Type | Description |
---|---|
System.String | A String that can be passed to Parse(String). |
WriteXml(XmlWriter)
Serializes the contents of this object into an XML stream.
Declaration
public void WriteXml(XmlWriter writer)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | writer | Represents the XML stream. |
Operators
Equality(GridBorder, GridBorder)
Performs the basic function of the "==" operator on the given two objects.
Declaration
public static bool operator ==(GridBorder lhs, GridBorder rhs)
Parameters
Type | Name | Description |
---|---|---|
GridBorder | lhs | The left-hand side of the operator. |
GridBorder | rhs | The right-hand side of the operator. |
Returns
Type | Description |
---|---|
System.Boolean | A boolean value. |
Inequality(GridBorder, GridBorder)
Performs the basic function of the "!=" operator on the given two objects.
Declaration
public static bool operator !=(GridBorder lhs, GridBorder rhs)
Parameters
Type | Name | Description |
---|---|---|
GridBorder | lhs | The left-hand side of the operator. |
GridBorder | rhs | The right-hand side of the operator. |
Returns
Type | Description |
---|---|
System.Boolean | Boolean value. |
Explicit Interface Implementations
ISerializable.GetObjectData(SerializationInfo, StreamingContext)
Implements the ISerializable interface and returns the data needed to serialize the GridBorder.
Declaration
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | A SerializationInfo object containing the information required to serialize the object. |
System.Runtime.Serialization.StreamingContext | context | A StreamingContext object containing the source and destination of the serialized stream. |