Class GridBagConstraints
Specifies how components will be positioned inside a container managed by the GridBagLayout manager.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Tools
Assembly: Syncfusion.Shared.Base.dll
Syntax
public class GridBagConstraints : ICloneable
Remarks
GridBagConstraints are a set of properties that determine how a component will grow, shrink or reposition itself when its container is resized.
Each component has its own GridBagConstraints which means that there is potential for unforseen size and boundary conflicts. Make sure to manually test the layout design to determine that it behaves appropriately.
Constructors
GridBagConstraints()
Overloaded. Creates a new instance of the GridBagConstraints class and sets its defaults.
Declaration
public GridBagConstraints()
GridBagConstraints(Int32, Int32, Int32, Int32, Double, Double, AnchorTypes, FillType, Insets, Int32, Int32, Boolean)
Creates a new instance of the GridBagConstraints class with the specified values.
Declaration
public GridBagConstraints(int gridPosX, int gridPosY, int cellSpanX, int cellSpanY, double weightX, double weightY, AnchorTypes anchor, FillType fill, Insets insets, int ipadX, int ipadY, bool isEmpty)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | gridPosX | Grid column beggining position. |
System.Int32 | gridPosY | Grid row beggining position. |
System.Int32 | cellSpanX | The number of columns this component should span in the virtual grid. |
System.Int32 | cellSpanY | The number of rows this component should span in the virtual grid. |
System.Double | weightX | The weight of the component to obtain the extra horizontal space. |
System.Double | weightY | The weight of the component to obtain the extra vertical space. |
AnchorTypes | anchor | The justification of a component within its available layout bounds. |
FillType | fill | The filltype to resize the components in layout bounds. |
Insets | insets | Adding the extra space arround the components preferred bounds. |
System.Int32 | ipadX | The amount of pixels to add to the component size while calculating the overall width. |
System.Int32 | ipadY | The amount of pixels to add to the component size while calculating the overall height. |
System.Boolean | isEmpty | Represents the GridBagConstraints structure with its properties left uninitialized. |
Fields
Empty
Declaration
public static readonly GridBagConstraints Empty
Field Value
Type |
---|
GridBagConstraints |
Relative
Relative positioning preference.
Declaration
public const int Relative = -1
Field Value
Type |
---|
System.Int32 |
Remainder
Makes the child component occupy the remainder of the row / column.
Declaration
public const int Remainder = 0
Field Value
Type |
---|
System.Int32 |
Properties
Anchor
Gets or sets the justification of a component within its available layout bounds (a cell in the virtual grid).
Declaration
public AnchorTypes Anchor { get; set; }
Property Value
Type | Description |
---|---|
AnchorTypes | One of the AnchorTypes values. Default is center. |
CellSpanX
Gets or sets the number of columns this component should span in the virtual grid.
Declaration
public int CellSpanX { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of columns to span, default is 1. Can be zero (GridBagConstraints.Remainder). |
Remarks
When value is zero, the component will be the last one in its row.
CellSpanY
Gets or sets the number of rows this component should span in the virtual grid.
Declaration
public int CellSpanY { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of rows to span, default is 1. Can be zero (GridBagConstraints.Remainder). |
Remarks
When value is zero, the component will be the last one in its column.
Fill
Gets or sets the fill type to resize a component when the component's layout bounds are larger than its preferred size.
Declaration
public FillType Fill { get; set; }
Property Value
Type | Description |
---|---|
FillType | One of the FillType values. The default is none. |
GridPosX
Gets or sets the column in the virtual grid where the component's layout bounds begin.
Declaration
public int GridPosX { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | A value specifying the beginning column. Can be -1. Default is -1. |
Remarks
When -1, the positioning is relative, which means the component will be positioned immediately to the right of the component that was most recently added to the container.
GridPosY
Gets or sets the row in the virtual grid where the component's layout bounds begin.
Declaration
public int GridPosY { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | A value specifying the beginning row. Can be -1. Default is -1(GridBagConstraints.Relative). |
Remarks
When -1, the positioning is relative, which means the component will be positioned immediately to the bottom of the component that was most recently added to the container.
Insets
Gets or sets the extra space that the manager adds around a component's preferred bounds before laying out the component.
Declaration
public Insets Insets { get; set; }
Property Value
Type | Description |
---|---|
Insets | An Inset's instance. Default is zero inset padding on all sides. |
IpadX
Gets or sets the amount in pixels to add to the size of the component when determining its overall width.
Declaration
public int IpadX { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The integer value representing the padding in pixels. Default is zero. |
IpadY
Gets or sets the amount in pixels to add to the size of the component when determining its overall height.
Declaration
public int IpadY { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The integer value representing the padding in pixels. Default is zero. |
IsEmpty
Gets or sets the GridBagConstraints structure with its properties left uninitialized.
Declaration
public bool IsEmpty { get; set; }
Property Value
Type |
---|
System.Boolean |
WeightX
Gets or sets the weight of this component in obtaining the extra horizontal space.
Declaration
public double WeightX { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double value representing the weight. Default is zero. |
Remarks
Specifies how to distribute extra horizontal space for a column. The weight of a column is calculated as the maximum WeightX of all the components in that column.
When there is extra horizontal space it is distributed to each column based on its weight. A component that has zero weight receives no extra space.
WeightY
Gets or sets the weight of this component in obtaining the extra vertical space.
Declaration
public double WeightY { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A double value representing the weight. Default is zero. |
Remarks
Specifies how to distribute extra vertical space for a row. The weight of a row is calculated as the maximum WeightY of all the components in that row.
When there is extra vertical space it is distributed to each row based on its weight. A component that has zero weight receives no extra space.
Methods
Clone()
Creates an exact copy of this GridBagConstraints object.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | The cloned object. |
Default()
Returns a default GridBagConstraints object that is also empty.
Declaration
public static GridBagConstraints Default()
Returns
Type | Description |
---|---|
GridBagConstraints | The default GridBagConstraints object. |
Equals(Object)
Overridden. See System.Boolean.Equals(System.Object).
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | The GridBagConstraints object. |
Returns
Type |
---|
System.Boolean |
Overrides
GetHashCode()
Overridden. See System.Object.GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
---|
System.Int32 |
Overrides
OnPropertyChanged()
Declaration
protected virtual void OnPropertyChanged()
Events
PropertyChanged
Raises when GridBagConstraints properties changed.
Declaration
public event EventHandler PropertyChanged
Event Type
Type |
---|
System.EventHandler |
Operators
Equality(GridBagConstraints, GridBagConstraints)
The basic == operator.
Declaration
public static bool operator ==(GridBagConstraints lhs, GridBagConstraints rhs)
Parameters
Type | Name | Description |
---|---|---|
GridBagConstraints | lhs | The left-hand side of the operator. |
GridBagConstraints | rhs | The right-hand side of the operator. |
Returns
Type | Description |
---|---|
System.Boolean | Boolean value. |
Inequality(GridBagConstraints, GridBagConstraints)
The basic != operator.
Declaration
public static bool operator !=(GridBagConstraints lhs, GridBagConstraints rhs)
Parameters
Type | Name | Description |
---|---|---|
GridBagConstraints | lhs | The left-hand side of the operator. |
GridBagConstraints | rhs | The right-hand side of the operator. |
Returns
Type | Description |
---|---|
System.Boolean | Boolean value. |