Class GridControl
Displays data in a customizable grid. Wraps the System.Windows.Forms.DataGridView control.
Inheritance
Inherited Members
Namespace: FastReport.Dialog
Assembly: FastReport.dll
Syntax
public class GridControl : DialogControl, IComponent, IDisposable, IFRSerializable, IHasEditor, IParent
Constructors
GridControl()
Initializes a new instance of the GridControl class with default settings.
Declaration
public GridControl()
Properties
AllowUserToAddRows
Gets or sets a value indicating whether the option to add rows is displayed to the user. Wraps the System.Windows.Forms.DataGridView.AllowUserToAddRows property.
Declaration
public bool AllowUserToAddRows { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
AllowUserToDeleteRows
Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView. Wraps the System.Windows.Forms.DataGridView.AllowUserToDeleteRows property.
Declaration
public bool AllowUserToDeleteRows { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
AlternatingRowsDefaultCellStyle
Gets or sets the default cell style applied to odd-numbered rows of the DataGridView. Wraps the System.Windows.Forms.DataGridView.AlternatingRowsDefaultCellStyle property.
Declaration
public DataGridViewCellStyle AlternatingRowsDefaultCellStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridViewCellStyle |
AutoSizeColumnsMode
Gets or sets a value indicating how column widths are determined. Wraps the System.Windows.Forms.DataGridView.AutoSizeColumnsMode property.
Declaration
public DataGridViewAutoSizeColumnsMode AutoSizeColumnsMode { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridViewAutoSizeColumnsMode |
AutoSizeRowsMode
Gets or sets a value indicating how row heights are determined. Wraps the System.Windows.Forms.DataGridView.AutoSizeRowsMode property.
Declaration
public DataGridViewAutoSizeRowsMode AutoSizeRowsMode { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridViewAutoSizeRowsMode |
BackColor
This property is not relevant to this class.
Declaration
[Browsable(false)]
public override Color BackColor { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Color |
Overrides
BackgroundColor
Gets or sets the background color of the DataGridView. Wraps the System.Windows.Forms.DataGridView.BackgroundColor property.
Declaration
public Color BackgroundColor { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Color |
BorderStyle
Gets or sets the border style for the DataGridView. Wraps the System.Windows.Forms.DataGridView.BorderStyle property.
Declaration
public BorderStyle BorderStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.BorderStyle |
CellBorderStyle
Gets the cell border style for the DataGridView. Wraps the System.Windows.Forms.DataGridView.CellBorderStyle property.
Declaration
public DataGridViewCellBorderStyle CellBorderStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridViewCellBorderStyle |
ColumnHeadersBorderStyle
Gets the border style applied to the column headers. Wraps the System.Windows.Forms.DataGridView.ColumnHeadersBorderStyle property.
Declaration
public DataGridViewHeaderBorderStyle ColumnHeadersBorderStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridViewHeaderBorderStyle |
ColumnHeadersDefaultCellStyle
Gets or sets the default column header style. Wraps the System.Windows.Forms.DataGridView.ColumnHeadersDefaultCellStyle property.
Declaration
public DataGridViewCellStyle ColumnHeadersDefaultCellStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridViewCellStyle |
ColumnHeadersHeight
Gets or sets the height, in pixels, of the column headers row. Wraps the System.Windows.Forms.DataGridView.ColumnHeadersHeight property.
Declaration
public int ColumnHeadersHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
ColumnHeadersHeightSizeMode
Gets or sets a value indicating whether the height of the column headers is adjustable and whether it can be adjusted by the user or is automatically adjusted to fit the contents of the headers. Wraps the System.Windows.Forms.DataGridView.ColumnHeadersHeightSizeMode property.
Declaration
public DataGridViewColumnHeadersHeightSizeMode ColumnHeadersHeightSizeMode { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode |
ColumnHeadersVisible
Gets or sets a value indicating whether the column header row is displayed. Wraps the System.Windows.Forms.DataGridView.ColumnHeadersVisible property.
Declaration
public bool ColumnHeadersVisible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Columns
Gets the collection of GridControlColumn objects that represents the grid columns.
Declaration
public GridControlColumnCollection Columns { get; }
Property Value
Type | Description |
---|---|
GridControlColumnCollection |
DataGridView
Gets an internal DataGridView.
Declaration
[Browsable(false)]
public DataGridView DataGridView { get; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridView |
DataSource
Gets or sets the data source that the DataGridView is displaying data for.
Declaration
public DataSourceBase DataSource { get; set; }
Property Value
Type | Description |
---|---|
DataSourceBase |
DefaultCellStyle
Gets or sets the default cell style to be applied to the cells in the DataGridView if no other cell style properties are set. Wraps the System.Windows.Forms.DataGridView.DefaultCellStyle property.
Declaration
public DataGridViewCellStyle DefaultCellStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridViewCellStyle |
ForeColor
This property is not relevant to this class.
Declaration
[Browsable(false)]
public override Color ForeColor { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Color |
Overrides
GridColor
Gets or sets the color of the grid lines separating the cells of the DataGridView. Wraps the System.Windows.Forms.DataGridView.GridColor property.
Declaration
public Color GridColor { get; set; }
Property Value
Type | Description |
---|---|
System.Drawing.Color |
MultiSelect
Gets or sets a value indicating whether the user is allowed to select more than one cell, row, or column of the DataGridView at a time. Wraps the System.Windows.Forms.DataGridView.MultiSelect property.
Declaration
public bool MultiSelect { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ReadOnly
Gets a value indicating whether the user can edit the cells of the DataGridView control. Wraps the System.Windows.Forms.DataGridView.ReadOnly property.
Declaration
public bool ReadOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
RowHeadersBorderStyle
Gets or sets the border style of the row header cells. Wraps the System.Windows.Forms.DataGridView.RowHeadersBorderStyle property.
Declaration
public DataGridViewHeaderBorderStyle RowHeadersBorderStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridViewHeaderBorderStyle |
RowHeadersDefaultCellStyle
Gets or sets the default style applied to the row header cells. Wraps the System.Windows.Forms.DataGridView.RowHeadersDefaultCellStyle property.
Declaration
public DataGridViewCellStyle RowHeadersDefaultCellStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridViewCellStyle |
RowHeadersVisible
Gets or sets a value indicating whether the column that contains row headers is displayed. Wraps the System.Windows.Forms.DataGridView.RowHeadersVisible property.
Declaration
public bool RowHeadersVisible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
RowHeadersWidth
Gets or sets the width, in pixels, of the column that contains the row headers. Wraps the System.Windows.Forms.DataGridView.RowHeadersWidth property.
Declaration
public int RowHeadersWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
RowHeadersWidthSizeMode
Gets or sets a value indicating whether the width of the row headers is adjustable and whether it can be adjusted by the user or is automatically adjusted to fit the contents of the headers. Wraps the System.Windows.Forms.DataGridView.RowHeadersWidthSizeMode property.
Declaration
public DataGridViewRowHeadersWidthSizeMode RowHeadersWidthSizeMode { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode |
RowsDefaultCellStyle
Gets or sets the default style applied to the row cells of the DataGridView. Wraps the System.Windows.Forms.DataGridView.RowsDefaultCellStyle property.
Declaration
public DataGridViewCellStyle RowsDefaultCellStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridViewCellStyle |
ScrollBars
Gets or sets the type of scroll bars to display for the DataGridView control. Wraps the System.Windows.Forms.DataGridView.ScrollBars property.
Declaration
public ScrollBars ScrollBars { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.ScrollBars |
SelectionMode
Gets or sets a value indicating how the cells of the DataGridView can be selected. Wraps the System.Windows.Forms.DataGridView.SelectionMode property.
Declaration
public DataGridViewSelectionMode SelectionMode { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Forms.DataGridViewSelectionMode |
Text
This property is not relevant to this class.
Declaration
[Browsable(false)]
public override string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
Methods
AddChild(Base)
Adds a child object to this object's childs.
Declaration
public void AddChild(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child | Object to add. |
CanContain(Base)
Gets a value indicating that this object can contain the specified child object.
Declaration
public bool CanContain(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child | Child object. |
Returns
Type | Description |
---|---|
System.Boolean | true if this object can contain the specified child object; otherwise, false. |
Clear()
Clears the object's state.
Declaration
public override void Clear()
Overrides
Remarks
This method also disposes all object's children.
DeserializeSubItems(FRReader)
Deserializes nested object properties.
Declaration
protected override void DeserializeSubItems(FRReader reader)
Parameters
Type | Name | Description |
---|---|---|
FRReader | reader | Reader object. |
Overrides
Remarks
Typically the object serializes all properties to the single xml item:
<TextObject Name="Text2" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>
Some objects like DataBand have child objects that serialized in subitems:
<DataBand Name="Data1" Top="163" Width="718.2" Height="18.9">
<TextObject Name="Text3" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>
</DataBand>
To read such subitems, the DeserializeSubItems
method is used. Base
implementation reads the child objects. You may override it to read some specific subitems.
FinalizeControl()
Finalizes the control after its parent form is closed.
Declaration
public override void FinalizeControl()
Overrides
Remarks
This method is called when report is run.
GetChildObjects(ObjectCollection)
Gets a list of child objects.
Declaration
public void GetChildObjects(ObjectCollection list)
Parameters
Type | Name | Description |
---|---|---|
ObjectCollection | list | List to fill with values. |
GetChildOrder(Base)
Returns z-order of the specified child object.
Declaration
public int GetChildOrder(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child | Child object. |
Returns
Type | Description |
---|---|
System.Int32 | Z-order of the specified object. |
Remarks
This method must return the index of a specified child object in the internal child list.
GetContextMenu()
Gets the object's context menu.
Declaration
public override ContextMenuBase GetContextMenu()
Returns
Type | Description |
---|---|
ContextMenuBase | Null reference if object does not have a menu. |
Overrides
Remarks
Do not call this method directly. You may override it if you are developing a new component for FastReport.
You may use base menu classes such as ComponentBaseMenu, ReportComponentBaseMenu to create own context menus.
InitializeControl()
Initializes the control before display it in the dialog form.
Declaration
public override void InitializeControl()
Overrides
Remarks
This method is called when report is run.
RemoveChild(Base)
Removes a specified object from this object's childs.
Declaration
public void RemoveChild(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child |
Serialize(FRWriter)
Serializes the object.
Declaration
public override void Serialize(FRWriter writer)
Parameters
Type | Name | Description |
---|---|---|
FRWriter | writer | Writer object. |
Overrides
Remarks
Do not call this method directly. You should override it if you are developing a new component for FastReport.
This method is called when the object needs to save the state. It may happen when:
- saving the report to the file or stream;
- saving the report to the designer's undo buffer;
- assigning the object to another object using the Assign(Base) or AssignAll methods;
- saving the object to the designer's clipboard;
- saving the object to the preview (when run a report).
SetChildOrder(Base, Int32)
Sets the z-order of the specified object.
Declaration
public void SetChildOrder(Base child, int order)
Parameters
Type | Name | Description |
---|---|---|
Base | child | Child object. |
System.Int32 | order | New Z-order. |
Remarks
This method must place the specified child object at the specified position in the internal child list.
UpdateLayout(Single, Single)
Updates the children layout when the size of this object is changed by dx, dy values.
Declaration
public void UpdateLayout(float dx, float dy)
Parameters
Type | Name | Description |
---|---|---|
System.Single | dx | X delta. |
System.Single | dy | Y delta. |
Remarks
This method must update positions/sizes of child objects whose Dock or Anchor properties are set to non-default values.