Class GridModelRowColSizeIndexer
Implements the method that manages row heights and column widths in a grid and lets you change them. Events will be raised in the grid when settings are changed.
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public abstract class GridModelRowColSizeIndexer : GridModelBound, IDisposable, ISerializable
Remarks
You typically access this class from a grid using the RowHeights and ColWidths properties of a GridModel.
This class raises the following events in a GridModel:
Items-Descriptions
Constructors
GridModelRowColSizeIndexer(GridModel)
Initializes a new instance ofGridModelRowColSizeIndexer and associates it with a GridModel.
Declaration
protected GridModelRowColSizeIndexer(GridModel model)
Parameters
Type | Name | Description |
---|---|---|
GridModel | model | A reference to the parent GridModel. |
GridModelRowColSizeIndexer(SerializationInfo, StreamingContext)
Initializes a new instance of GridModelRowColSizeIndexer from a serialization stream.
Declaration
protected GridModelRowColSizeIndexer(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | An object that holds all the data needed to serialize or de-serialize this instance. |
System.Runtime.Serialization.StreamingContext | context | Describes the source and destination of the serialized stream specified by info. |
Properties
Dictionary
Gets or sets storage for all row heights or column widths in the grid.
Declaration
public IGridRowColSizeDictionary Dictionary { get; set; }
Property Value
Type |
---|
IGridRowColSizeDictionary |
Remarks
You can replace this dictionary at run-time with a custom dictionary if you implement the IGridRowColSizeDictionary interface.
IsHidden
Declaration
public GridModelHideRowColsIndexer IsHidden { get; }
Property Value
Type |
---|
GridModelHideRowColsIndexer |
Item[Int32]
Returns or sets the row height or column width for the specified index. Hidden rows or columns will return 0. If row or column has default size, the DefaultSize is returned.
Declaration
public int this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type |
---|
System.Int32 |
Remarks
Call ResetRange reset values to default. Call IsDefault to check if a value is reset to default. Call IsHidden[n] to check if a row or column is hidden.
Item[String]
Returns or sets the row height or column width for the row or column that matches the specified name. Hidden rows or columns will return 0. If row or column has default size, the DefaultSize is returned.
Declaration
public abstract int this[string name] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Property Value
Type |
---|
System.Int32 |
Remarks
Call ResetRange reset values to default. Call IsDefault to check if a value is reset to default. Call IsHidden[n] to check if a row or column is hidden.
Modified
Gets a value indicating whether the dictionary was modified.
Declaration
public bool Modified { get; }
Property Value
Type |
---|
System.Boolean |
RowColName
Gets "RowHeight" or "ColumnWidth" string.
Declaration
public abstract string RowColName { get; }
Property Value
Type |
---|
System.String |
RowColObject
Declaration
public abstract GridModelRowColOperations RowColObject { get; }
Property Value
Type |
---|
GridModelRowColOperations |
Methods
EvalRange(Int32, Int32[])
Call EvalRange to change a given array of row and column sizes and determine actual sizes for rows or columns that are reset to default or hidden.
Declaration
public int[] EvalRange(int startAt, int[] values)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startAt | First row or column index. |
System.Int32[] | values | The array to be evaluated. The values in the array will be changed. |
Returns
Type | Description |
---|---|
System.Int32[] | A reference to the values array (see param values). |
EvalRange(Int32, Int32[], Boolean[], Int32)
Call EvalRange to change a given array of row and column sizes and determine actual sizes for rows or columns that are reset to default or hidden.
Declaration
public int[] EvalRange(int startAt, int[] values, bool[] hidden, int defaultSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startAt | First row or column index. |
System.Int32[] | values | The array to be evaluated. The values in the array will be changed. |
System.Boolean[] | hidden | An array that specifies which rows or columns are hidden. |
System.Int32 | defaultSize | The default row or column width in the grid. |
Returns
Type | Description |
---|---|
System.Int32[] | A reference to the values array (see param values). |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | if |
GetObjectData(SerializationInfo, StreamingContext)
Implements the ISerializable interface and returns the data needed to serialize the GridModelRowColSizeIndexer.
Declaration
public virtual void 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. |
GetRange(Int32, Int32)
Gets an array of row or column sizes. The array will have negative values for rows and columns that are reset default size. Hidden rows and columns are returned in their original size.
Declaration
public int[] GetRange(int from, int last)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | from | First row or column. |
System.Int32 | last | Last row or column. |
Returns
Type | Description |
---|---|
System.Int32[] | An array with row and column sizes. |
Remarks
Call EvalRange to change the array and determine actual sizes for rows or or columns that are reset to default or hidden.
GetSize(Int32)
Returns the raw size data for the given row or column.
Declaration
public int GetSize(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The row or column index. |
Returns
Type | Description |
---|---|
System.Int32 | The size of the row or column. It is -1 if the size of the row or column is reset to default. |
GetTotal(Int32, Int32)
Gets the total size for the specified range of rows or columns.
Declaration
public int GetTotal(int from, int last)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | from | The first row or column. |
System.Int32 | last | The last row or column. |
Returns
Type | Description |
---|---|
System.Int32 | The total size. |
GetTotal(Int32, Int32, Int32)
Gets the total size for the specified range of rows or columns.
Declaration
public int GetTotal(int from, int last, int maximum)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | from | The first row or column. |
System.Int32 | last | The last row or column. |
System.Int32 | maximum | Maximum value for total. |
Returns
Type | Description |
---|---|
System.Int32 | The total size. |
IsDefault(Int32)
Determines if row or column at the specified index is reset to default.
Declaration
public bool IsDefault(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Row or column index. |
Returns
Type | Description |
---|---|
System.Boolean | True if value is reset to default; False otherwise. |
OnChanged(GridRowColSizeChangedEventArgs)
Used internally.
Declaration
public abstract void OnChanged(GridRowColSizeChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridRowColSizeChangedEventArgs | e |
OnChanging(GridRowColSizeChangingEventArgs)
Used internally.
Declaration
public abstract bool OnChanging(GridRowColSizeChangingEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridRowColSizeChangingEventArgs | e |
Returns
Type | Description |
---|---|
System.Boolean | returns boolean value |
OnQuerySize(GridRowColSizeEventArgs)
Used internally.
Declaration
protected abstract void OnQuerySize(GridRowColSizeEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridRowColSizeEventArgs | e |
OnQuerySizeTotal(GridRowColSizeTotalEventArgs)
Used internally.
Declaration
protected abstract void OnQuerySizeTotal(GridRowColSizeTotalEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridRowColSizeTotalEventArgs | e |
OnSaveSize(GridRowColSizeEventArgs)
Used internally.
Declaration
protected abstract void OnSaveSize(GridRowColSizeEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
GridRowColSizeEventArgs | e |
ResetModified()
Resets the Modified flag.
Declaration
public void ResetModified()
ResetRange(Int32, Int32)
Resets the range of rows or columns to default size.
Declaration
public void ResetRange(int from, int last)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | from | First row or column index in range. |
System.Int32 | last | Last row or column index in range. |
ResetSize(Int32)
Resets the row or column to default size.
Declaration
public void ResetSize(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Row or column index. |
ResizeToFit(GridRangeInfo)
Resizes a range of rows or columns to optimally fit contents of the specified range of cells.
Declaration
public bool ResizeToFit(GridRangeInfo range)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | The range of cells to be analyzed. |
Returns
Type | Description |
---|---|
System.Boolean | True if any changes were made; False if all sizes were already optimal. |
ResizeToFit(GridRangeInfo, GridResizeToFitOptions)
Determines whether resize a range of rows or column to optimally fit contents of the specified range of cells and given options.
Declaration
public abstract bool ResizeToFit(GridRangeInfo range, GridResizeToFitOptions options)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | The range of cells to be analyzed. |
GridResizeToFitOptions | options | Specifies whether row or column headers should be included; if size can be reduced and if covered cells should be considered. |
Returns
Type | Description |
---|---|
System.Boolean | True if any changes were made; False if all sizes were already optimal. |
ResizeToFit(GridRangeInfo, Boolean, Boolean)
Determines whether the range of rows and columns should be resized to optimally fit. Used internally.
Declaration
[Obsolete("Use GridResizeToFitOptions instead")]
public bool ResizeToFit(GridRangeInfo range, bool resizeCovered, bool noShrink)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | |
System.Boolean | resizeCovered | |
System.Boolean | noShrink |
Returns
Type | Description |
---|---|
System.Boolean | returns boolean value |
ResizeToFitOptimized(GridRangeInfo)
Determines whether resize the range of rows to optimally fit.
Declaration
public bool ResizeToFitOptimized(GridRangeInfo range)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | The range of cells to be analyzed. |
Returns
Type | Description |
---|---|
System.Boolean | True if any changes were made; False if all sizes were already optimal. |
ResizeToFitOptimized(GridRangeInfo, GridResizeToFitOptions)
Determines whether resize the range of rows to optimally fit.
Declaration
public bool ResizeToFitOptimized(GridRangeInfo range, GridResizeToFitOptions option)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | The range of cells to be analyzed. |
GridResizeToFitOptions | option | Get the result for the particular ResizeToFit Options. |
Returns
Type | Description |
---|---|
System.Boolean | True if any changes were made; False if all sizes were already optimal. |
ResizeToFitOptimized(GridRangeInfo, GridResizeToFitOptions, GridTextOptions)
Determines whether resize a range of rows or column to optimally fit
Declaration
public abstract bool ResizeToFitOptimized(GridRangeInfo range, GridResizeToFitOptions options, GridTextOptions textOption)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | The range of cells to be analyzed. |
GridResizeToFitOptions | options | Specifies whether row or column headers should be included; if size can be reduced and if covered cells should be considered. |
GridTextOptions | textOption | text option |
Returns
Type |
---|
System.Boolean |
ResizeToFitOptimized(GridRangeInfo, GridTextOptions)
Determines whether resize the range of rows to optimally fit.
Declaration
public bool ResizeToFitOptimized(GridRangeInfo range, GridTextOptions textOption)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | The range of cells to be analyzed. |
GridTextOptions | textOption | get the result for the particular text option |
Returns
Type | Description |
---|---|
System.Boolean | True if any changes were made; False if all sizes were already optimal. |
SetRange(Int32, Int32, Int32)
Changes the size of a range of rows or columns.
Declaration
public void SetRange(int from, int last, int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | from | First row or column index in range. |
System.Int32 | last | Last row or column index in range. |
System.Int32 | value | The size to be applied. |
Remarks
The method will generate undo information and push it onto the grid's command stack.
A RowHeightsChanging or (ColWidthsChanging) event is raised before the values are modified and gives event listeners a chance to discard the operation before any change happens.
If the RowHeightsChanging event did not signal to cancel, the operation will go ahead, apply changes and raise a RowHeightsChanged or (ColWidthsChanged) event. The Changed event will indicate if changes were successful or not.
SetRange(Int32, Int32, Int32[])
Changes the size of a range of rows or columns.
Declaration
public void SetRange(int from, int last, int[] values)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | from | First row or column index in range. |
System.Int32 | last | Last row or column index in range. |
System.Int32[] | values | An array with sizes to be applied. |
SetRange(Int32, Int32, Int32[], Boolean)
Changes the size of rows or columns in the specified range.
Declaration
public void SetRange(int from, int last, int[] values, bool discardUndo)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | from | First row or column index in range. |
System.Int32 | last | Last row or column index in range. |
System.Int32[] | values | The sizes to be applies to the range. |
System.Boolean | discardUndo | Set this true if you do not want undo information to be pushed onto the grid's command stack. |
SetSize(Int32, Int32)
Saves the raw size data for the given row or column.
Declaration
public void SetSize(int index, int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The row or column index. |
System.Int32 | value | The new size of the row or column. -1 if the size of the row or column should be reset to default. |
Remarks
A negative value means that the size of the row or column should be reset to default. This method will not raise neither Changing nor Changed events.