Class GridMarginsInfo
Provides a StyleInfoSubObjectBase object for margins in a cell. Each margin side of the cell can be configured individually with a GridMargins value. Margin sides that have not been initialized will inherit default values from a base style.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridMarginsInfo : GridStyleInfoSubObject, ICustomTypeDescriptor, IDisposable, IStyleInfo, ISupportInitialize, IFormattable, IConvertible, IXmlSerializable, IStyleInfoSubObject
Examples
The following code changes margin information for cells:
GridMargins margins = new GridMargins(1, 1, 2, 2);
model[rowIndex, colIndex].Margins = new GridMarginsInfo(margins);
model[rowIndex, colIndex+1].Margins.Right = 2;
model[rowIndex, colIndex+1].Margins.Left = 2;
Constructors
GridMarginsInfo()
Initializes a new empty instance ofGridMarginsInfo class.
Declaration
public GridMarginsInfo()
GridMarginsInfo(StyleInfoSubObjectIdentity)
Initalizes a new GridMarginsInfo object and associates it with an existing GridStyleInfoSubObjectIdentity.
Declaration
public GridMarginsInfo(StyleInfoSubObjectIdentity identity)
Parameters
Type | Name | Description |
---|---|---|
StyleInfoSubObjectIdentity | identity | A GridStyleInfoSubObjectIdentity that holds the indentity for this GridMarginsInfo. |
GridMarginsInfo(StyleInfoSubObjectIdentity, GridMarginsInfoStore)
Initalizes a new instance ofGridMarginsInfo object and associates it with an existing GridStyleInfoSubObjectIdentity.
Declaration
public GridMarginsInfo(StyleInfoSubObjectIdentity identity, GridMarginsInfoStore store)
Parameters
Type | Name | Description |
---|---|---|
StyleInfoSubObjectIdentity | identity | A GridStyleInfoSubObjectIdentity that holds the indentity for this GridMarginsInfo. |
GridMarginsInfoStore | store | A GridMarginsInfoStore that holds data for this GridMarginsInfo. All changes in this style object will saved in the GridMarginsInfoStore object. |
GridMarginsInfo(GridMargins)
Initializes a new instances ofGridMarginsInfo and copies settings from a GridMargins object.
Declaration
public GridMarginsInfo(GridMargins margins)
Parameters
Type | Name | Description |
---|---|---|
GridMargins | margins | A GridMargins object used to initialize the current object. |
GridMarginsInfo(Int32, Int32, Int32, Int32)
Initializes a new instances ofGridMarginsInfo and saves left, top, right and bottom margins.
Declaration
public GridMarginsInfo(int left, int top, int right, int bottom)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | left | Left margin. |
System.Int32 | top | The top margin. |
System.Int32 | right | The right margin. |
System.Int32 | bottom | The bottom margin. |
Properties
Bottom
Gets or sets the bottom margin
Declaration
public int Bottom { get; set; }
Property Value
Type |
---|
System.Int32 |
Default
Gets a default GridMarginsInfo to be used with a default style.
Declaration
public static GridMarginsInfo Default { get; }
Property Value
Type |
---|
GridMarginsInfo |
Remarks
The Default of the GridStyleInfo class will return the default margin info that this method generates through its overridden version of GetDefaultStyle().
Empty
Gets a empty GridMarginsInfo.
Declaration
public static GridMarginsInfo Empty { get; }
Property Value
Type |
---|
GridMarginsInfo |
HasBottom
Gets a value indicating whether the bottom margin has been initialized.
Declaration
public bool HasBottom { get; }
Property Value
Type |
---|
System.Boolean |
HasLeft
Gets a value indicating whether the left margin has been initialized.
Declaration
public bool HasLeft { get; }
Property Value
Type |
---|
System.Boolean |
HasRight
Gets a value indicating whether the right margin has been initialized.
Declaration
public bool HasRight { get; }
Property Value
Type |
---|
System.Boolean |
HasTop
Gets a value indicating whether the top margin has been initialized.
Declaration
public bool HasTop { get; }
Property Value
Type |
---|
System.Boolean |
Left
Gets or sets the left margin
Declaration
public int Left { get; set; }
Property Value
Type |
---|
System.Int32 |
Right
Gets or sets the right margin
Declaration
public int Right { get; set; }
Property Value
Type |
---|
System.Int32 |
Top
Gets or sets the top margin
Declaration
public int Top { get; set; }
Property Value
Type |
---|
System.Int32 |
Methods
GetDefaultStyle()
Override this method to return a default style object for your derived class.
Declaration
protected override StyleInfoBase GetDefaultStyle()
Returns
Type | Description |
---|---|
StyleInfoBase | A default style object. |
Overrides
MakeCopy(StyleInfoBase, StyleInfoProperty)
Creates an exact copy of the current object.
Declaration
public override IStyleInfoSubObject MakeCopy(StyleInfoBase newOwner, StyleInfoProperty sip)
Parameters
Type | Name | Description |
---|---|---|
StyleInfoBase | newOwner | The new owner style object for the copied object. |
StyleInfoProperty | sip | An identifier for this object. |
Returns
Type | Description |
---|---|
IStyleInfoSubObject | A duplicate object. |
Overrides
ResetBottom()
Resets the bottom margin
Declaration
public void ResetBottom()
ResetLeft()
Resets the left margin
Declaration
public void ResetLeft()
ResetRight()
Resets the right margin
Declaration
public void ResetRight()
ResetTop()
Resets the top margin
Declaration
public void ResetTop()
ToMargins()
Converts this object to a GridMargins object.
Declaration
public GridMargins ToMargins()
Returns
Type | Description |
---|---|
GridMargins | A GridMargins object filled with the current objects settings. |