C1.Win.C1FlexGrid.2
Static class containing UI strings used by the designer.
Represents a filter that contains a and a
.
Gets the contained in this .
Gets the contained in this .
Gets or sets a value that determines whether the filter is active.
Resets the filter making it inactive.
Applies the filter to a value.
Value to be filtered.
True if the satisfies the filter; False otherwise.
Gets the editor used to modify the filter at run time.
A that is used to edit the filter
at run time.
Interface implemented by column filter objects.
Gets a value that determines whether the filter is active.
Resets the filter making it inactive.
Applies the filter to a value.
Value to be filtered.
True if the satisfies the filter;
False otherwise.
Gets the editor used to modify the filter at run time.
A to be used to modify the filter at
run time.
The control returned must implement the
interface.
Interface implemented by column filter editor controls.
Initializes the editor with parameters from a filter to be edited.
that contains the column to be filtered.
Index of the column that contains the values to be filtered.
being edited.
Applies changes to the filter being edited.
Gets a value that determines whether the containing form should remain
open even when it is deactivated.
This property allows custom editors to display modal dialogs.
Represents a filter based on a set of values.
Gets or sets an array with the values that should be included in the output.
Setting this property to null causes the filter to include all values in the output.
Gets or sets the limit count of displayed values in value filter.
Gets or sets a value that determines whether the filter is active.
Resets the filter making it inactive.
Applies the filter to a value.
Value to be filtered.
True if the satisfies the filter; False otherwise.
Gets the editor used to modify the filter at run time.
A that is used to edit the filter at run time.
Static class containing UI strings used by the designer.
Summary description for GridDesigner.
Gets the design time action lists supported by the component associated
with this designer.
Initializes the designer with the specified component.
Component associated with the designer.
Releases the resources associated with the designer.
True to release all resources, false to release unmanaged resources only.
Indicates whether a mouse click at the specified point should be handled by the control.
Point indicating the mouse position, in screen coordinates.
True if the control should handle the click, false otherwise.
Helper class that provides information about a currently active ComboBox editor.
Gets or sets the selected index in the currently active ComboBox editor.
If there's no active editor, or if the editor is not a ComboBox,
the value returned is -1.
Gets or sets the selected item in the currently active ComboBox editor.
If there's no active editor, or if the editor is not a ComboBox,
the value returned is null.
Gets the key that corresponds to the selected item in the currently
active ComboBox editor.
If there's no active editor, if the editor is not a , or if the cell
being edited does not have an associated DataMap, the value returned is null.
Gets the collection of items in the currently active ComboBox editor.
If there's no active editor, or if the editor is not a ComboBox,
the value returned is null.
Interface implemented by editors and used by the grid to host edit controls
on cells.
All built-in grid editors implement this interface, as do the controls in the
ComponentOne C1Input library.
If you want to use a third-party editor with the , consider
creating a derived class and implementing this interface.
Note that the methods in IC1EmbeddedEditor are called using reflection.
Controls do not need to implement the entire interface. Any public methods with matching
signatures (names, parameters, and return values) will be invoked by the grid.
The grid supplies default handlers for any methods not implemented by the control.
Called to initialize the editor content and styles.
Contains the grid data that should be displayed in the editor.
Contains a dictionary with keys that correspond to style element names and values for the cell being edited.
The dictionary contains the following keys:
BackColor: Cell background color.
ForeColor: Cell foreground color.
Font: Cell font.
Format: Cell format string (e.g. "#,##0.##").
ContentAlignment: Cell text alignment.
Margins: Extra margins around the cell content (in pixels).
Wrap: Whether word wrapping is enabled.
Gets the current value of the editor.
The current value of the editor (any data type).
Gets a value that determines if the editor's current contents are valid.
True if the editor currently has valid content (e.g it contains
an EditMask and all required positions have been filled).
Called to update the editor's size and position.
The bounds of the cell being edited, in client coordinates.
This method is called during initialization and also when the grid scrolls.
Gets a value that determines whether a given key should finalize editing.
Key to be tested.
True if the key should finish the edits and close the editor.
If this method returns true, the grid copies the editor value to the cell and
exits edit mode. The key is then processed by the grid (unless the e.Handled
parameter is set to true).
For example, pressing the down arrow typically causes the grid to exit edit
mode and move the cursor to the next row.
The default handler returns true for the TAB, ENTER, and ESC keys.
It also handles the arrow keys for editors based on TextBox, ComboBox,
and DateTimePicker controls.
Formats a given value using a specified mask.
Value to be formatted.
Formatting mask.
A string containing the formatted value.
The default implementation ignores the mask and returns value.ToString().
Gets the editor style, which determines the type of button that is displayed in
the cell before and during editing (DropDown, Modal, or None).
The default handler returns DropDown for ComboBoxes, DateTimePickers, and
UpDown controls. It returns None for other control types.
The UITypeEditorEditStyle enumeration is defined in the System.Drawing.Design
namespace. The available settings are DropDown, Modal, and None.
Interface that extends and can be used to implement multi-column data maps.
Gets the string that should be displayed in the grid while not in edit mode.
Value to look up in the dictionary.
The string that should be displayed in the grid while not in edit mode.
When the is used to populate a ,
all columns are displayed when the combo is dropped down. When the combo is closed, only one
column can be displayed. This method returns that value.
Interface that extends and can be used to implement multi-column data maps.
Gets the string which is in given column of the dictionary.
Value to look up in the dictionary.
>Column index in the dictionary.
The string that should be displayed in the grid while not in edit mode.
Class that implements the and can be used as
a column DataMap to create multi-column combo editors.
The class can be used to implement simple string-based
data maps or bound data maps that get the data from a data source object.
The code below creates an unbound two-column data map and assigns it to a grid column:
// create string-based MultiColumnDictionary and assign it to column
// note: this will automatically generate keys of type 'int' for each item,
// the key values will be stored in the grid.
string text = "Row1, Col1\tRow1, Col2|Row2, Col1\tRow2, Col3|Row2, Col1\tRow3, Col2";
MultiColumnDictionary map = new MultiColumnDictionary(text, 0, true);
_flex.Cols[1].DataMap = map;
The map consists of three items, each with two columns. Because the autoKeys
parameter was set to true in the map's constructor, the map will have unique integer keys for
each value,and those integers will be stored in the grid cells. If autoKeys
had been set to false, the strings themselves would be used as keys and stored in the grid
cells.
The code below creates a bound data map and assigns it to a grid column:
// create data-based MultiColumnDictionary and assign it to column
// notes: the list will automatically be updated is the data source changes.
DataTable dt = GetDataTable("employees");
string[] columnNames = new string[] { "FirstName", "LastName", "Country" };
MultiColumnDictionary map = new MultiColumnDictionary(dt, "EmployeeID", columnNames, 1);
_flex.Cols[2].DataMap = map;
This map is bound to an Employees DataTable. The keyColumn parameter is set
to "EmployeeID", causing this field to be used as a key. When the grid is edited, the values
stored in the cells will be the employee's ID. However, this value is never displayed be the grid.
The drop-down list will show the employee's first name, last name, and country, as specified by the
columnNames parameter.
When the list is closed, the grid will display the employee's last name, as specified
by the displayColumn parameter.
Note that this map is dynamically bound to the data source, so if the employees table is
modified, the editor list will reflect the changes automatically.
Note also that the usual combo editing features such as auto-search and double-click cycling
still work.
Initializes a new instance of an unbound class.
String that contains the items, delimited by pipe characters ("|").
Each item may contain multiple columns, delimited by tabs (vbTab or '\t').
This constructor causes the map to show all columns when the editor is dropped down and only the
first column when the editor is closed or inactive.
Initializes a new instance of an unbound class.
String that contains the items. Items are delimited by pipe characters ("|").
Each item may contain multiple columns, delimited by tabs (vbTab or '\t').
Index of the column that is displayed in the grid.
True if keys are to be automatically generated, false if the items themselves are
to be used as keys. Note that in the latter case, duplicate items are not allowed.
Initializes a new instance of a bound class.
Data source object.
Name of the data source column that contains unique keys.
Array with the names of the columns that are included in the map.
Name of the column that is displayed in the grid.
Initializes a new instance of a bound class.
Data source object.
Name of the data source column that contains unique keys.
This constructor causes the map to show all columns when the editor is dropped down and only the
first column when the editor is closed or inactive.
Initializes a new instance of a bound class.
Data source object.
Name of the data source column that contains unique keys.
Array with the names of the columns that are included in the map.
Name of the column that is displayed in the grid.
Initializes a new instance of a bound class.
Data source object.
Name of the data source column that contains unique keys.
Removes all entries from the .
Adds an entry with the specified key and value into the .
Gets or sets the value associated with the specified key
The key of the value to get or set.
Gets the string which is in given column of the dictionary.
Value to look up in the dictionary.
>Column index in the dictionary.
The string that should be displayed in the grid while not in edit mode.
Specifies how adjacent cells are merged for display.
Do not merge any cells.
Merge any adjacent cells with same contents.
Merge rows only if cells above are also merged.
Merge columns only if cells to the left are also merged.
Merge cells only if cells above or to the left are also merged.
Merge only fixed cells. This setting is useful for setting up complex
headers for the data and preventing the data itself from being merged.
Allow long entries to spill into empty adjacent cells.
Allow long entries in node rows to spill into empty adjacent cells.
Use collection to determine which cells are merged.
Use the setting specified for the property.
The C1FlexGrid control is a powerful, full-featured grid.
C1FlexGrid provides advanced features such as outline trees, cell merging,
masked editing, translated combo and image lists, owner-draw cells, and automatic
data aggregation.
C1FlexGrid can be used in bound mode, where it displays data from .NET
data sources, or in unbound mode, where the grid itself manages the data.
You can use C1FlexGrid to read and write Excel files (.Xls), or read and write
grid contents to and from Xml files.
Classes derived from should have a LicenseProvider
attribute so Visual Studio will embed the appropriate licensing information into
projects that use the derived control.
For example:
[LicenseProvider(typeof(LicenseProvider))]
public class MyGrid : C1FlexGrid
{
// implementation
}
Creates a new instance of the control.
Gets or sets how cells should be merged.
Merging cells allows you to display data in a clear, appealing way,
because it highlights groups of identical information. It also gives you
flexibility to build tables similar to the ones you can create in HTML or
using Microsoft Word, both of which support merged cells.
To create tables with merged cells, set the
property to a value other than , and
set the property of individual rows and
columns true for the rows and columns you wish to merge. After these
properties are set, the grid will automatically merge adjacent cells
that have the same contents.
Whenever the cell contents change, the grid updates the merging state.
The code below causes the grid to merge cells with the same data in column 1:
flex.AllowMerging = AllowMergingEnum.Free;
flex.Cols[1].AllowMerging = true; // merge values in column 1
Gets or sets how non-scrollable cells should be merged.
By default, this property is set to , which
causes fixed cells to be merged with the same setting as scrollable cells.
If you specify a different value for this property, you can use different merging
modes for fixed cells such as column headers than the setting used for scrollable cells.
Returns the merged range of cells that includes a given cell.
Row index.
Column index.
Whether the range should be clipped to the visible area of the grid.
A object that contains the given cell.
Cell merging is controlled by the property.
The method allows you to determine whether a cell is
merged with adjacent cells.
You can override the method to implement custom merging
logic. If you do this, make sure the merging method is consistent and efficient, since
it gets called frequently and affects the grid's appearance and behavior.
The code below checks the current cell after a selection to see if it is part
of a merged range:
private void _flex_SelChange(object sender, System.EventArgs e)
{
CellRange rg = this._flex.GetMergedRange(_flex.Row, _flex.Col, false);
if (!rg.IsSingleCell)
{
Console.WriteLine("selection is merged: {0},{1}-{2},{3}",
rg.TopRow, rg.LeftCol, rg.BottomRow, rg.RightCol);
}
}
The code below shows how you can override the method
to provide custom merging:
public class CustomMerge : C1FlexGrid
{
public CustomMerge()
{
// allow free merging by default
AllowMerging = AllowMergingEnum.Free;
for (int r = 0; r < Rows.Count; r++) Rows[r].AllowMerging = true;
for (int c = 0; c < Cols.Count; c++) Cols[c].AllowMerging = true;
}
override public CellRange GetMergedRange(int row, int col, bool clip)
{
// merge cells in range (1,1)-(3,3)
if (row >= 1 && row <= 3 && col >= 1 && col <= 3)
return GetCellRange(1, 1, 3, 3);
// don't merge anything else
return GetCellRange(row, col);
}
}
Returns the merged range of cells that includes a given cell.
Row index.
Column index.
A object that contains the given cell.
This method returns the entire range, including invisible cells.
Gets the that determines which grid
cells are merged when the property is set to
.
Reflects grid over its main diagonal.
The Transpose method also removes sorting and filtering for every columns.
Overridden to clear merged ranges.
Gets the state for a Windows XP theme while the mouse moves over a cell.
This method is for internal use. It allows inherited classes to customize the hot-tracking behavior.
Row under the mouse.
Column under the mouse.
An integer representing the item state (2 for hot-tracking, 1 for normal).
Gets a cell glyph to show in a cell.
This method is for internal use. It allows inherited classes to customize the display of the sorting glyphs.
Row index.
Column index.
Cell rectangle
Glyph to display above the cell content.
Glyphs to display on the left of the cell.
Glyphs to display on the right of the cell.
True if any glyphs were assigned to the cell, false otherwise.
Applies a value to a cell or cell range.
This method is for internal use. It allows inherited classes to customize the way data
coming from cell editors is applied to the cells.
Row index.
Column index.
Data to be applied to the cell.
Whether the data should be coerced into the cell's data type.
Applies a value to a cell or cell range.
This method is for internal use. It allows inherited classes to customize the way checkbox
data is applied to the cells.
Row index.
Column index.
Value to apply to the cell.
Invalidates a cell range, causing it to be repainted.
Range to be invalidated.
This method is rarely used by the programmer, since the grid automatically
performs invalidation as needed.
Gets a rectangle representing the coordinates of a cell, row, or column.
This method is for internal use. It allows inherited classes to customize the way cell geometry
is calculated.
Row index (or -1 to get column bounds).
Column index (or -1 to get row bounds).
Whether the rectangle should be horizontally clipped to the grid's client area.
Whether the rectangle should be vertically clipped to the grid's client area.
A containing the display area for the row, column, or cell, in client
coordinates and accounting for scroll position.
Gets a rectangle representing the coordinates of a cell editor.
This method is for internal use. It allows inherited classes to customize the way cell geometry
is calculated.
Row index.
Column index.
Rectangle used to position the cell editor.
Starts editing a cell in response to a key press.
This method is for internal use. It allows inherited classes to customize the editing process.
Row index.
Column index.
Key that initiated the edit process.
Whether editing should start even in non-editable cells (e.g. fixed cells).
True if the editing process was started successfully, false otherwise.
Starts editing a cell in response to a mouse action.
This method is for internal use. It allows inherited classes to customize the editing process.
Row index.
Column index.
Mouse position in client coordinates.
Whether the action was a double-click.
True if the editing process was started successfully, false otherwise.
Gets a value that determines if a cell contains the grid cursor.
Row index.
Column index.
True if the cell contains the cursor, false otherwise.
Gets a value that determines if a cell is part of the selection and should be highlighted.
Row index.
Column index.
True if the cell should be highlighted, false otherwise.
Gets a value that indicates what types of child nodes a row has.
This method is for internal use. It allows inherited classes to customize outline trees.
Row index.
Column index.
Outline level.
Zero if the row has no children, 1 if it has regular data rows only,
2 if it has child nodes, and 3 if it has data and child nodes.
Draws a grid row.
A that contains a
object where the row will be drawn.
Index of the row to draw.
This method is for internal use. It allows inherited classes to customize the grid appearance.
Draws a grid cell.
A that contains a
object where the cell will be drawn.
Index of the cell's row.
Index of the cell's column.
The index of the last column painted (may be greater than
if columns are merged).
This method is for internal use. It allows inherited classes to customize the grid appearance.
Draws a grid cell.
object where the cell will be drawn.
Index of the cell's row.
Index of the cell's column.
that defines the cell position.
This method is for internal use. It allows inherited classes to customize the grid appearance.
Moves or extends the current selection.
value that specifies the type of cursor movement.
Whether to extend the current selection.
This method is for internal use. It allows inherited classes to customize the grid appearance.
Automatically size grid columns to fit the largest entry.
object used to measure the cell contents.
Index of the first row to be measured.
Index of the first column to be measured.
Index of the last row to be measured.
Index of the first column to be measured.
Extra space, in twips, to add to the largest entry.
value that specifies auto sizing behavior.
This method is for internal use. It allows inherited classes to customize the grid appearance.
Automatically size grid columns to fit the largest entry.
object used to measure the cell contents.
Index of the first row to be measured.
Index of the first column to be measured.
Index of the last row to be measured.
Index of the first column to be measured.
Extra space, in twips, to add to the largest entry.
value that specifies auto-sizing behavior.
This method is for internal use. It allows inherited classes to customize the grid appearance.
Raises the event.
Object raising the event.
A that contains event data.
Called when the grid contents scroll.
value that specifies the scroll direction.
This method is for internal use. It allows inherited classes to customize the grid scrolling behavior.
Specifies whether the user should be able to resize rows and columns with the mouse.
The user may not resize rows or columns.
The user may resize columns with the mouse by dragging the edge of the column headers.
Double-clicking the edge of a column header automatically sizes the column to fit the widest entry.
The user may resize rows with the mouse by dragging the edge of the row headers.
Double-clicking the edge of a row header automatically sizes the row to fit the tallest entry.
The user may resize rows and columns with the mouse.
The user may change the default column width with the mouse.
Resizing any column will resize all columns that don't have a specific width assigned to them.
The user may change the default row height with the mouse.
Resizing any row will resize all rows that don't have a specific height assigned to them.
The user may change the default column width or row height with the mouse.
Specifies whether the user should be able to freeze rows and columns with the mouse.
The user may not freeze rows or columns.
The user may freeze columns by dragging the frozen region vertical boundary with the mouse.
The user may freeze rows by dragging the frozen region horizontal boundary with the mouse.
The user may freeze rows and columns by dragging the frozen region boundaries with the mouse.
Specifies whether the user should be able to drag rows and columns with the mouse.
The user may not drag rows or columns.
The user may drag columns with the mouse.
The user may drag rows with the mouse.
The user may drag rows and columns with the mouse.
Specifies whether the user should be able to sort columns with the mouse.
The user may not sort columns with the mouse.
The user may sort single columns by clicking on its header cell.
The user may sort a range of columns by clicking on the header cell
of the rightmost column in the range.
Specifies whether the grid should highlight the selected range.
Never highlight the selected range.
Always highlight the selected range.
Highlight the selected range when the control has focus.
Specifies the appearance of the focus rectangle.
No focus rectangle.
Show a light focus rectangle (dotted, 1-pixel wide). This is the default setting.
Show a heavy focus rectangle (dotted, 2-pixel wide).
Show a solid focus rectangle. The color of the rectangle is determined by the
BackColor property of the style.
Show a raised focus rectangle.
Show an inset focus rectangle.
Specifies options that control auto-sizing.
Default behavior.
All rows (or columns) in the range are set to the same size.
Ignore invisible rows (or columns) when auto-sizing.
Ignore merged cells when auto-sizing.
Specifies whether cells should be drawn entirely by the grid or with
help from custom drawing code.
Grid cells are drawn by the grid.
The grid fires the event to allow custom
cell drawing.
Specifies which elements of the cell should be drawn by the grid.
This enumeration is used when rendering owner-drawn cells.
If you set the property to ,
the grid will fire the event to allow custom cell drawing.
The parameter passed to the event handler has a
method that allows you to use the standard
drawing routines for rendering parts of the cell. For example, you can paint a custom background
and use the standard drawing routines for the cell borders and content.
See the event for an example.
Draw the cell background.
Draw the cell border.
Draw the cell content (text, images, check boxes, etc).
Draw all cell elements (background, border, and contents).
Specifies when the grid should display combo buttons in cells.
Show buttons only while editing the cell.
Show buttons when the cell has the focus. This is the default setting for grid.
Always show buttons.
Never show buttons.
ShowButtons property of the column is inherited from the grid. This is default setting for column. Cannot be used with ShowButtons property of the grid.
Specifies options that customize the grid's editing behavior.
No special behavior.
Search for entries in lists as the user types.
Cycle to the next item on the list when the user double-clicks a cell.
Check and uncheck all check boxes in a selection simultaneously.
Use built-in numeric editor when editing numeric types.
Commit changes to data source only when changing rows or moving focus.
Exit editor if user presses the right arrow key at the end of the content
or the left arrow key at the start of the content.
Enter edit mode only in response to mouse or keyboard events. Setting this
flag to false causes the grid to enter edit mode when the control gets the
focus or when the user moves the cursor.
All of the above.
Specifies whether the control should use themes for displaying row or column headers.
Use themed headers when the property is set to XpThemes.
Do not use themed headers.
Use themed headers for row headers.
Use themed headers for column headers.
Use themed headers for row and column headers.
Use themed headers to indicate selected rows and columns when VisualStyle
is set to one of the Office styles.
Specifies options that customize scrollbar behavior.
Use the default scrolling behavior.
Keep scrollbars visible even when they are disabled.
Scroll by rows and columns (instead of by pixel).
Do not scroll the control contents until the user releases the scrollbar thumb.
Fire the event and display a tooltip next to
the vertical scrollbar while scrolling vertically.
Do not scroll the control to the first cell of merged range.
Specifies what parts of the grid should be copied to the clipboard when the
property is set to true.
Only the selected data is copied.
Copy the selected data and include the column headers.
Copy the selected data and include the row headers.
Copy the selected data and include row and column headers.
Do not copy any data to the clipboard.
Specifies the position of the sort glyphs within the column header cells.
Do not show sort glyphs.
Show sort glyphs on the right of the column header cells.
Show sort glyphs on the top of the column header cells.
Show sort glyphs on the top of the column header cells if filtering
is enabled, and on the right otherwise.
Base class for the control.
Releases all resources used by the .
True to release both managed and unmanaged resources;
False to release only unmanaged resources.
Signals the object that initialization is starting.
Signals the object that initialization is complete.
Occurs when the filter localizes a string in the user interface.
The control automatically localizes the
column filter based on the system's current culture and in the setting
of the property.
This event allows you to customize the filter strings or to
implement localization to languages that are not supported by the grid's
built-in localization mechanism.
To modify the content of any of the filter's UI elements, handle
this event and set the e.Value parameter to the text you would
like to display.
The example below shows how you can change the strings in the filter
UI based on the string value and on the name of the controls being
localized:
void Initialize()
{
// enable filtering
_flex.AllowFiltering = true;
// set GetLocalizedString handler
_flex.GetLocalizedString += _flex_GetLocalizedString;
}
void _flex_GetLocalizedString(object sender, C1.Win.C1FlexGrid.GetLocalizedStringEventArgs e)
{
// customize item based on text value
if (e.Value == "(Select All)")
{
e.Value = "(Select Everything)";
}
// customize item based on component name
switch (e.ComponentName)
{
case "_btnApplyFilter":
e.Value = "OK";
break;
case "_btnClearFilter":
e.Value = "Reset";
break;
case "_btnCancel":
e.Value = "Close";
break;
}
}
Raises the event.
that contains the event data.
Creates a new accessibility object for the control.
A new for the control.
Retrieves the specified .
Row index of the accessibility object to return.
The for the specified row.
Raises the event.
An that contains the event data.
Gets the default size of the control.
Fires when the grid or its contents change.
This is a general event that fires before more specific events.
For example, if the user drags a column with the mouse, the control fires the
, , and
events.
The GridChanged event allows you to create a centralized handler
for all types of grid events. It does not provide detailed arguments for
every event, nor the option of canceling user actions.
Raises the event.
Fires before the event is handled by the grid.
This event fires before the grid processes the event, and
gives the program a chance to customize the behavior of the control and optionally
cancel the default handling of the mouse.
The code below handles the event to detect clicks
on row headers and provide OLE drag and drop functionality.
void _flex_BeforeMouseDown(object sender, C1.Win.C1FlexGrid.BeforeMouseDownEventArgs e)
{
// start dragging when the user clicks the row headers
HitTestInfo hti = _flex.HitTest(e.X, e.Y);
if (hti.Type == HitTestTypeEnum.RowHeader)
{
e.Cancel = true; // cancel default handling
HandleRowDragDrop(hti.Row); // handle row drag/drop
}
}
Raises the event.
Fires before the DoubleClick event is handled by the grid.
This event fires before the grid processes the event, and
gives the program a chance to customize the behavior of the control and optionally
cancel the default handling of the mouse.
The code below handles the event to detect double-clicks
on cells in a specific column and provide a custom edit dialog instead of using the
built-in editor.
void _flex_BeforeDoubleClick(object sender, C1.Win.C1FlexGrid.BeforeMouseDownEventArgs e)
{
// detect double-clicks on column "Customer"
HitTestInfo hti = _flex.HitTest(e.X, e.Y);
if (hti.Type == HitTestTypeEnum.Cell && _flex[hti.Column].Name == "Customer")
{
e.Cancel = true; // cancel default handling
ShowCustomEditDialog(hti.Row, hti.Column); // handle row drag/drop
}
}
Fires when the user starts dragging a row.
This event only fires when the user drags a row using the mouse.
It does not fire when a row is moved using the method.
You can prevent specific rows from being dragged by the user by setting their
property to false.
Raises the event.
A that contains the event data.
Fires as the user drags a row to a new position.
This event only fires when the user drags a row using the mouse.
It does not fire when a row is moved using the method.
You can prevent specific rows from being dragged by the user by setting their
property to false.
Raises the event.
A that contains the event data.
Fires after the user finishes dragging a row.
This event only fires when the user drags a row using the mouse.
It does not fire when a row is moved using the method.
You can prevent specific rows from being dragged by the user by setting their
property to false.
Raises the event.
A that contains event data.
Fires when the user starts dragging a column.
This event only fires when the user drags a column using the mouse.
It is does not fire when a column is moved using the method.
You can prevent specific columns from being dragged by the user by setting their
property to false.
Raises the event.
A that contains event data.
Fires as the user drags a column to a new position.
This event only fires when the user drags a column using the mouse.
It does not fire when a row is moved using the method.
You can prevent specific columns from being dragged by the user by setting their
property to false.
Raises the event.
A that contains the event data.
Fires after the user finishes dragging a column.
This event only fires when the user drags a column using the mouse.
It does not fire when a column is moved using the method.
You can prevent specific columns from being dragged by the user by setting their
property to false.
Raises the event.
A that contains event data.
Fires before a column is sorted by a click on a column header.
This event only fires if the sorting was caused by a click on a column header. It does not fire
before sorting with the method.
This event is useful when you want to prevent the user from sorting certain columns or to specify
custom sorting orders for specific columns. You may do so by modifying the value of the
parameter.
Raises the event.
A that contains event data.
Fires after a column is sorted by a click on a column header.
This event only fires if the sorting was caused by a click on a column header cell (see the
property). It does not fire after sorting with the method.
This event is useful if you want to update user interface elements to reflect the new sorting.
To prevent certain columns from being sorted, or to alter their default sorting order, use the
or handle the event.
Raises the event.
A that contains event data.
Fires before a row is automatically resized by a double-click on a row header.
Raises the event.
A that contains event data.
Fires before a column is automatically resized by a double-click on a column header.
Raises the event.
A that contains event data.
Fires before a row is resized by dragging the row header.
Use the grid's property to determine whether users
are allowed to resize rows, columns, or both.
and
objects also have an property
that allows you to prevent specific rows and columns from being resized.
Raises the event.
A that contains event data.
Fires after a row is resized by dragging the row header.
This event is fired after a row is resized by the user, by dragging the edge
of the row header cell with the mouse (see the property).
It is not fired when a row is resized by assigning a new value to the
property.
Raises the event.
A that contains event data.
Fires before a column is resized by dragging the column header.
Raises the event.
A that contains event data.
Fires after a column is resized by dragging the column header.
This event is fired after a column is resized by the user, by dragging the edge
of the column header cell with the mouse (see the property).
It is not fired when a column is resized by assigning a new value to the
property.
Raises the event.
A that contains event data.
Fires before rows are frozen by dragging the frozen row divider.
Use the property to enable or disable row and column freezing.
Raises the event.
A that contains event data.
Fires after rows are frozen by dragging the frozen row divider.
Use the property to enable or disable row and column freezing.
Raises the event.
A that contains event data.
Fires before columns are frozen by dragging the frozen column divider.
Use the property to enable or disable row and column freezing.
Raises the event.
A that contains event data.
Fires after columns are frozen by dragging the frozen column divider.
Use the property to enable or disable row and column freezing.
Raises the event.
A that contains event data.
Fires when the mouse enters a cell.
Many applications track mouse movement and react to the cell that is currently
under the mouse. This can be done using the event, but that
is not very efficient since the event fires many times while the mouse is over the
same cell.
The MouseEnterCell event allows you to implement cell tracking
efficiently, since it only fires once until the mouse leaves the cell.
The code below tracks mouse movement and highlights the cell under the mouse:
void Form1_Load(object sender, EventArgs e)
{
// create style for tracking cell under the mouse
CellStyle cs = _flex.Styles.Add("track");
cs.BackColor = Color.Gold;
}
void _flex_MouseEnterCell(object sender, RowColEventArgs e)
{
// apply tracking style when mouse enters the cell
_flex.SetCellStyle(e.Row, e.Col, _flex.Styles["track"]);
}
void _flex_MouseLeaveCell(object sender, RowColEventArgs e)
{
// remove tracking style when mouse leaves the cell
_flex.SetCellStyle(e.Row, e.Col, (CellStyle)null);
}
Raises the event.
that contains the event data.
Fires when the mouse leaves a cell.
Raises the event.
that contains the event data.
Fires before the grid scrolls.
Raises the event.
A that contains event data.
Fires after the grid scrolls.
This event allows you to prevent the user from scrolling the grid while an operation
is being performed on the current selection.
The code below prevents the grid from scrolling while the grid is in edit mode.
void _flex_BeforeScroll(object sender, C1.Win.C1FlexGrid.RangeEventArgs e)
{
if (_flex.Editor != null)
e.Cancel = true;
}
Raises the event.
A object that contains event data.
Fires before the vertical ScrollTip is displayed.
This event fires only if the ShowScrollTips flag is set in the property.
It allows you to specify the text that will be displayed in the scroll tip.
The code below uses the event to display a scroll tip showing the value of the
first cell that will become visible when the user stops scrolling.
_flex.ScrollOptions = ScrollFlags.DelayedScroll | ScrollFlags.ShowScrollTips;
void _flex_ShowScrollTip(object sender, ToolTipEventArgs e)
{
e.ToolTipText = string.Format("row {0}", e.Row);
}
Raises the event.
A object that contains event data.
Fires before the current cell changes ( and properties).
This event fires before the or properties change, either as a
result of user actions or through code. It allows you to prevent the selection of certain cells,
thus creating "protected" ranges on a grid.
fires only when the or
properties are about to change. To detect extended selections, you also need to handle the
event.
Raises the event.
A that contains event data.
Fires after the current cell changes ( and properties).
This event fires before the or properties change, either as a
result of user actions (mouse or keyboard) or through code. It allows you to display additional information
about the currently selected row, column, or cell.
To perform validation or prevent certain cells from being selected, use the
and events instead.
Raises the event.
A that contains event data.
Fires before the selection changes (, , , properties).
This event fires before the and properties change, either as a result
of user actions or through code. It allows you to prevent the selection of certain cells, thus creating
"protected" ranges on a grid.
To prevent the selection of a range, you also need to handle the event, which
is fired before the Row and Col properties change.
Raises the event.
A that contains event data.
Fires after the selection changes (, , ,
properties).
This event is fired after the or properties change, either as
a result of user actions (mouse or keyboard) or through code.
This event is useful if you want to display additional information about the current selection. To
perform validation or prevent certain cells from being selected, use the and
events instead.
Raises the event.
A that contains event data.
Fires after the current cell changes ( and properties).
fires when the or properties change, either
as a result of user actions (mouse or keyboard) or through code.
This event does not fire when the selection changes ( or properties)
but the active cell (, ) remains the same. In this case, the
event fires instead.
Raises the event.
A that contains event data.
Fires after the selection changes (, , ,
properties).
fires after the , , ,
or properties change, either as a result of user actions (mouse or keyboard)
or through code.
This event also fires while the user extends the selection with the mouse.
Raises the event.
An that contains event data.
Fires before the current cell changes ( and properties).
This event fires before the cursor leaves the current cell, either as a result of user actions
(mouse or keyboard), or through code.
Raises the event.
An that contains event data.
Fires after the current cell changes ( and properties).
This event fires after the cursor enters a cell, either as a result of user actions (mouse or keyboard),
or through code.
Raises the event.
An that contains event data.
Fires before the grid enters edit mode, and also when the cell that has the
focus needs to be painted.
This event doesn't fire only when the grid is about to enter edit mode.
It also fires while painting cells, in order to support drawing the editor's
drop-down buttons.
The event fires only when the grid is about to enter
edit mode.
Raises the event.
A that contains event data.
Fires before the control enters edit mode.
This event fires before the control enters edit mode. It allows you to prevent
editing by setting the Cancel parameter to true, or to supply a list of choices
for a combo list using the property, or an edit mask using the
property.
If the choices or the mask are the same for a whole column, you may set them more
efficiently using the and
properties for the object. In this case, there's no need to handle
the StartEdit event at all.
The grid also exposes a event. The difference between
the two is that BeforeEdit fires when the grid paints the cell that has the focus
(so it can determine whether the cell has a drop-down button). BeforeEdit fires
more often than StartEdit, and does not always indicate that the grid is actually
entering edit mode.
Raises the event.
A that contains event data.
Fires after a cell has been edited.
This event does not fire if the user cancels the edits by pressing the ESC key.
The event fires whenever the grid leaves edit mode,
even if the edits were canceled.
Raises the event.
A that contains event data.
Fires after the control leaves edit mode.
Raises the event.
A that contains event data.
Fires after the user clicks a cell button.
This event fires when the user clicks an edit button on a cell. Typically,
this event is used to pop up a custom editor for the cell (for example, dialogs for
selecting colors, dates, files, pictures, and so on).
By default, cell edit buttons are displayed on the right side of a cell,
with an ellipsis caption ("..."). They are similar to the buttons displayed in the
PropertyGrid control, next to Image properties. You may customize
the button's appearance by assigning a picture to the property.
To create an edit button on a cell, you must set the
property to true and set the property (on the grid or on specific
columns) to an ellipsis ("...").
Raises the event.
A that contains event data.
Fires after a cell editor has been initialized by the grid, to allow additional custom initialization.
This event can be used to customize the behavior of the cell editor by setting properties
on the editor control.
For example, the code below checks to see if the editor being used is a TextBox, and then
sets the editor's CharacterCasing and MaxLength properties.
void _flex_SetupEditor(object sender, RowColEventArgs e)
{
TextBox tb = _flex.Editor as TextBox;
if (tb != null)
{
if (_flex.Cols[e.Col].Name == "ID")
tb.MaxLength = 4;
else
tb.MaxLength = 32000;
}
}
Raises the event.
A that contains event data.
Fires before the control exits cell edit mode, while the editor is still active.
When this event fires, the contents of the editor have not been applied to the
grid. You can validate the editor contents and cancel the edits if necessary.
To validate the editor contents, check the value contained in the Editor.Text
property. If the value is invalid for the cell, set the Cancel parameter to true
and the grid will remain in edit mode until the user types a valid entry.
For example, the code below checks to make sure the value entered is an integer
between 0 and 100:
void _flex_ValidateEdit(object sender, ValidateEditEventArgs e)
{
if (_flex.Cols[e.Col].Name = "Score")
{
try
{
int value = int.Parse(_flex.Editor.Text);
if (value >= 0 && value <= 50)
return; // accept edits
}
catch {}
// error or invalid range, refuse edits
e.Cancel = true;
}
}
Raises the event.
A that contains event data.
Fires after a checkbox in a cell is checked or unchecked by the user.
Raises the event.
A that contains event data.
Fires in edit mode, after the contents of the editor change.
This event fires while the grid is in edit mode and the contents of the editor change.
This may be caused by the user typing into the editor or selecting a new item in a
drop down list.
When this event fires, the new editor content has not been applied to the grid cell yet.
You may check the new content using the property.
The code below shows a message when the text being edited contains more than 10 characters:
void _flex_ChangeEdit(object sender, EventArgs e)
{
// get text in editor
string text = _flex.Editor.Text;
// show message if it's too long
statusStrip1.Text = text.Length > 10
? "This text seems too long..."
: "This text looks OK...";
}
Raises the event.
An that contains event data.
Fires in edit mode, when the dropdown portion of an editor opens.
Raises the event.
A that contains event data.
Fires in edit mode, when the dropdown portion of an editor closes.
Raises the event.
A that contains event data.
Fires in edit mode, when the user presses a key.
The KeyDownEdit event corresponds to the event,
except it fires when the grid is in edit mode (in this case, the control that received the
key is the editor, not the grid itself).
The editor has three modes: text, drop-down combo, or drop-down list. The mode used is
determined by the properties in the grid and column objects.
While editing with the text editor or with a drop-down combo, you may set or retrieve
the contents of the editor by retrieving the editor control with the
property and casting it to the proper type.
Raises the event.
A that contains event data.
Fires in edit mode, when the user releases a key.
The event corresponds to the
event, except it fires when the grid is in edit mode (in this case, the control that
receives the key is the editor, not the grid itself).
The editor has three modes: text, drop-down combo, or drop-down list. The mode
used is determined by the properties in the grid and column objects.
While editing with the text editor or with a drop-down combo, you may set or retrieve
the contents of the editor by retrieving the editor control with the
property and casting it to the proper type.
Raises the event.
A that contains event data.
Fires in edit mode, when the user presses a character key.
The event corresponds to the
event, except it fires when the
grid is in edit mode (in this case, the control that receives the
key is the editor, not the grid itself).
The editor has three modes: text, drop-down combo, or drop-down list.
The mode used is determined by the properties in the
grid and column objects.
While editing with the text editor or with a drop-down combo, you may set
or retrieve the contents of the editor by retrieving the editor control with the
property and casting it to the proper type.
Raises the event.
A that contains event data.
Fires after the contents of a cell have changed.
This event allows you to perform processing whenever the contents of a cell
change, regardless of how they were changed (for example, a user typed data into
the cell, data got loaded from a database, or data was assigned to the grid through code).
This event can be used to provide conditional formatting and dynamic data summaries,
which get updated automatically whenever the data changes.
This event fires in bound and unbound modes. In some bound more scenarios, the
data source object may inform the grid that some data in the current row changed, without
specifying which column changed. In this case, the Col parameter will be set to -1.
Event handlers should be prepared to handle this situation without throwing exceptions.
Raises the event.
A that contains event data.
Fires after any data source change notifications.
When the grid is used in bound mode, any changes to the data source cause the
grid to fire the event. This event is the ideal place
to put code that updates the grid with data-dependent elements such as subtotals and
outline trees.
Note: The delegate is defined in
the System.ComponentModel namespace.
Raises the event.
A that contains event data.
Fires after the data source reports an error condition.
Raises the event.
A that contains event data.
Fires when the grid needs to retrieve data for an unbound cell.
This event fires in bound mode when the grid contains unbound columns.
Unbound columns are columns that have the Name property set to values
that do not map to columns in the data source. The information in unbound columns
must be provided by the application, by setting the Value property of the
parameter.
The class supports calculated columns that in many
situations can be used instead of unbound columns.
Raises the event.
An that contains event data.
Fires when the grid needs to store data in an unbound cell.
This event fires in bound mode when the grid contains unbound columns.
Unbound columns are columns that have the Name property set to values
that do not map to columns in the data source. The information in unbound columns
must be provided by the application using the event.
In most cases, unbound columns are read-only, and you don't need to handle this event.
However, if a value is assigned to an unbound cell, either through editing or programmatically,
the grid fires this event to allow the application to store the value using whatever mechanism
is appropriate.
Raises the event.
An that contains event data.
Fires after a data-binding operation has finished.
Raises the event.
that contains the event data.
Fires when the value of the property changes.
Raises the event.
that contains the event data.
Fires when the value of the property changes.
Raises the event.
that contains the event data.
Fires before a node row is collapsed or expanded.
Raises the event.
A that contains event data.
Fires after a node row is collapsed or expanded.
The and events
fire before and after node rows are expanded or collapsed. You can determine
whether the node is being collapsed or expanded by checking the value of the
node's its property.
These events allow you to populate outlines on demand, so you only need
to create the rows that will actually be shown to the user. For example, if
you are using the grid to display a directory tree, it would take a long time
to read each directory on the disk in order to populate the tree.
Raises the event.
A that contains event data.
Fires before the grid draws a cell, when the property is set to .
The OwnerDrawCell event only fires when the property is
set to .
You can use this event to customize the appearance of any cell in the grid.
The event allows three main types of customization:
-
Change the value of the Text and Image parameters to modify the values displayed
by the grid. You can use this type of customization to replace password strings with asterisks,
for example.
-
Change the Style property to display the cell using a different style than the one
selected by the grid by default. You can use this type of customization to provide conditional
formatting, for example.
-
Use the Graphics and Bounds parameters and draw the cell yourself. When drawing
cells this way, you may call the member to force
the grid to draw specific parts of the cell, while your code draws other parts. For example,
you could paint a custom background and then call DrawCell to have the grid paint the cell
border and contents.
The OwnerDrawCell event also fires when the grid auto sizes rows or columns (see the
and methods). This is done because the
grid needs to measure the cell using the same text, image, and style parameters that are used to
render it. In these cases, the Measuring parameter is set to true and the Bounds
rectangle is empty.
Raises the event.
An that contains event data.
Fires while the control is being printed to provide control over page breaks.
This event is fired while the control is being printed with the
method to provide control over page breaks.
Set the Cancel parameter to true to indicate that the given Row should
not be printed at the top of a page. In this case, the control will move the break point up
and fire the event again until it finds a valid break point. Note that you can only prevent
page breaks, not force them.
Raises the event.
A that contains event data.
Fires before the grid starts printing.
Raises the event.
A that contains event data.
Fires after the grid finishes printing.
This event is typically used to update the user interface and provide
feedback while printing the grid.
Use the method to print the grid and specify the document
name, common printing options, headers and footers.
Use the property to specify less common printing
options such as header and footer fonts, page margins, orientation, and so on.
Raises the event.
A that contains event data.
Fires after the grid finishes printing a page.
This event is typically used to provide feedback while printing the grid,
and to offer the user a cancel button that can be used to stop the printing process.
You can also use this event to add custom elements to the printed pages.
Use the method to print the grid and specify the document name,
common printing options, headers and footers.
Use the property to specify less common printing options
such as header and footer fonts, page margins, orientation, and so on.
Raises the event.
A that contains event data.
Fires before the grid starts an automatic OLE drag operation.
Raises the event.
A that contains event data.
Fires before a new row is added by the user.
This event only fires when is set to true and
the user creates a new empty row by moving the cursor into the last row on the grid.
It does not fire when a new row is added to the grid programmatically or when a
row is added to the grid's data source.
You can use this event to cancel the creation of new rows by setting the
Cancel parameter to true. In this case, the cursor does not move into
the new row.
Raises the event.
A that contains event data.
Fires after a new row is added by the user.
This event only fires when property is set to true
and the user creates a new empty row by moving the cursor into the last row on the
grid.
It does not fire when a new row is added to the grid programmatically or
through the grid's data source.
You can use this event to initialize the new rows.
When a new row is created this way, it is initially empty, and the user may
cancel the row by moving the cursor out of the new row before making any edits.
In this case, the grid fires the event and the new
(empty) row is removed.
Raises the event.
A that contains event data.
Fires when the cursor leaves the new row without making any changes to it.
For details, see the event.
Raises the event.
A that contains event data.
Fires before a row is deleted by the user.
This event only fires when is set to true and the
user deletes one or more rows by selecting them and pressing the DEL key.
It does not fire when rows are removed from the grid programmatically or through
the grid's data source.
You can use this event to cancel the deletion of the rows by setting the
Cancel parameter to true.
Raises the event.
A that contains event data.
Fires after one or more rows are deleted by the user.
This event only fires when property is set to True
and the user deletes one or more rows by pressing the DEL key. It does not fire
when rows are removed from the grid programmatically or through the grid's data source.
When this event fires, the rows have already been removed from the grid, so the
Row parameter is always set to E.
Raises the event.
A that contains event data.
Fires when is set to true and the control needs error information for a cell.
Raises the event.
A that contains event data.
Fires when is set to true and the control needs error information for a row.
Raises the event.
A that contains event data.
Fires before each subtotal row is added to the grid.
Subtotal rows are added when the method is invoked.
The event handler may prevent the grid from adding a particular row, or it
may customize the caption, style, and aggregate value used in the new subtotal row.
Raises the event.
that contains the event data.
Fires after each subtotal row has been added to the grid.
Subtotal rows are added when the method is invoked.
Raises the event.
that contains the event data.
Fires before the column filters are applied to the grid.
Raises the event.
that contains the event data.
Fires after the column filters have been applied to the grid.
Raises the event.
that contains the event data.
Gets or sets the data in a grid cell.
This is one of the indexers you can use to get or set the data stored in grid cells.
You can index cells using the row and column indices or using the row
index and column name.
Using integer indices is more efficient, because the grid doesn't have to
look up the column. Using column names is more flexible, because references
remain valid even if the user moves columns to a new position.
When assigning a value to a cell, the grid tries to convert it into the type
specified for the column (see the property). If the
grid can't convert the value, it fires the event and the
cell retains its original value.
The example below creates a column and assigns it a name, then sets the value of
a cell using the column index and retrieves the value using the column name:
// create a column, assign it a name and get the new index
Column myCol = flex.Cols.Add();
myCol.Name = "address";
myCol.DataType = typeof(string);
int colIndex = myCol.Index;
// assign a value to a cell using cell coordinates:
flex[1, colIndex] = "555, Broadway";
// get the value using the column name
string address = (string)flex[1, "address"];
MessageBox.Show("The address is " + address);
Gets or sets the data in a grid cell.
This is one of the indexers you can use to get or set the data stored in grid cells.
You can index cells using the row and column indices or using the row index and column name.
Gets a custom associated with a cell.
Row index.
Column name.
object associated with the cell,
or null if the cell doesn't have a custom style.
If the cell doesn't have a custom style, the grid paints it using one of the
built-in styles. The built-in style is selected based on the cell position
and state (fixed, scrollable, highlighted, etc). To retrieve the style that
will be used to paint the cell (custom or built-in) use the method.
Gets a custom associated with a cell.
Row index.
Column index.
object associated with the cell,
or null if the cell doesn't have a custom style.
If the cell doesn't have a custom style, the grid paints it using one of the
built-in styles. The built-in style is selected based on the cell position
and state (fixed, scrollable, highlighted, etc). To retrieve the style that
will be used to paint the cell (custom or built-in) use the method.
Assigns a custom to a cell.
Row index.
Column name.
The to associate with the cell.
The method is useful if you want to assign a new style
to a single cell. You can also reset the cell style by setting it to null (Nothing, in VB).
To apply a custom cell style to an entire row or column, set the row or column's
properties.
To apply a custom style to a range cells, use a object.
For example:
CellRange rg = _flex.GetCellRange(3, 3, 10, 10);
rg.Style = _flex.Styles["MyRangeStyle"];
Assigns a custom to a cell.
Row index.
Column index
The to associate with the cell.
The method is useful if you want to assign a new style
to a single cell. You can also reset the cell style by setting it to null (Nothing, in VB).
To apply a custom cell style to an entire row or column, set the row or column's
properties.
To apply a custom style to a range cells, use a object.
For example:
CellRange rg = _flex.GetCellRange(3, 3, 10, 10);
rg.Style = _flex.Styles["MyRangeStyle"];
Assigns a custom to a cell.
Row index.
Column index
Name of the new style.
Gets the style used to render a cell.
Row index.
Column index
object used to display the cell.
The object returned may be a composite with elements from several
styles. For example, a cell with the focus is painted with a style that contains elements
from the , a custom style associated with the cell,
row, and column (if available), and the style.
Gets the image displayed in a grid cell.
Row index.
Column name.
An object previously assigned to the cell using the
method.
Gets the image displayed in a grid cell.
Row index.
Column index.
An object previously assigned to the cell using the
method.
Sets the image displayed in a grid cell.
Row index.
Column name.
An object containing an image to display in the cell.
In addition to the usual cell contents, you can display images in cells.
There are two methods for showing images in cells:
1. You can use the and methods to
assign images directly to the cells. In this case, the cell contents and the image are
independent. To update the image, you need to call again.
2. You can use the property to associate images with
specific cell values. In this case, images are updated automatically whenever the cell
contents change. The property allows you to specify whether
the control should display the images in addition to or instead of the cell text.
Sets the image displayed in a grid cell.
Row index.
Column index.
An object containing an image to display in the cell.
In addition to the usual cell contents, you can display images in cells.
There are two methods for showing images in cells:
1. You can use the and methods to
assign images directly to the cells. In this case, the cell contents and the image are
independent. To update the image, you need to call again.
2. You can use the property to associate images with
specific cell values. In this case, images are updated automatically whenever the cell
contents change. The property allows you to specify whether
the control should display the images in addition to or instead of the cell text.
Gets or sets whether the user is allowed to resize rows and columns with the mouse.
To resize rows or columns, the mouse must be over the fixed area of the grid, and
close to a border between rows or columns. The mouse pointer will change into a sizing
pointer and the user can drag the row or column to change the row height or column width.
If a group of columns is selected (from first to last row) and the user resizes one
of them, all selected columns are resized. The same applies to rows.
If column sizing is allowed, users may double-click the resizing area to resize a
column so it will automatically fit the longest entry.
Rows with zero height and columns with zero width can't be resized by the user.
If you want to make them very small but still resizable, set their height or width to
one pixel, not to zero.
The and events fire
before resizing starts, and may be used to prevent resizing of specific rows and columns.
The and events fire after
resizing, and may be used to validate the user's action and to update the display.
Gets or sets whether the user is allowed to freeze rows and columns with the mouse.
Frozen cells remain on the screen when the user scrolls the control
(like fixed cells), but they are selectable and editable (like scrollable cells).
They are painted using the style.
To freeze rows or columns at runtime, the mouse must be near the edge of the
frozen area. The mouse pointer will then change into a 'freeze' pointer (looks like
a padlock) and the user can drag the frozen boundary to a new row or column.
Gets or sets whether the user is allowed to drag rows and columns with the mouse.
Row dragging may not work in bound mode. This is because some data sources
do not allow absolute positioning of rows.
ADO.NET DataTable object in particular do not support this.
Column dragging is supported for any data source, and row dragging is always
supported in unbound mode.
You can prevent specific rows and columns from being dragged by setting
their property to false.
Gets or sets when to highlight selected cells.
You can customize the appearance of highlighted cells by modifying the
property.
Gets or sets the type of focus rectangle to display.
If the focus rectangle is drawn, then the current cell is painted using
the style, which by default looks like a regular
scrollable cell (as in most spreadsheets and grids).
If the focus rectangle is hidden (using the setting),
the current cell is painted using the style.
Gets or sets whether the user is allowed to edit grid contents.
If you set to false, editing is disabled for the
entire grid.
To enable editing on some rows and columns, set to true
for the grid and set the or
properties to false for the rows and columns that should not be editable.
You can also disable editing of specific cells by handling the
event and setting the Cancel event parameter to true.
Gets or sets when to display combo buttons in cells.
By default, the grid will show editing buttons in cells only when they
have the focus. This is the same behavior used by the
control.
If you set to ,
the grid will display buttons on any cells that have associated lists, even if they
don't have the focus.
For details on how to associate lists with cells, see the ,
, and properties.
Gets or sets whether the grid displays a record selector image on the first fixed column.
The record selector is a small triangle similar to the one used in Access and most data grids.
Gets or sets whether the grid should display sorting glyphs (a triangle) on the headers of sorted columns.
Gets or sets a value that determines the position of the sort glyphs within column header cells.
Gets or sets whether the grid should display error information in cells and rows.
Setting this property to true causes the grid to display error information in cells and
rows. Error information is displayed as error icons in the cells or row headers. Moving the
mouse over the error icons show tooltips containing an error description.
The error information may be supplied directly by data sources that implement the
interface (for example, the DataTable class implements this
interface).
If the grid is bound to a data source that doesn't support ,
you can provide error information using the and
events.
Gets or sets whether the grid should display labels over cells whose contents are partially hidden.
Gets or sets whether the user is allowed to sort columns using the mouse.
When the grid is used in bound mode, the sorting is performed by the
object. If the data source object does not support sorting,
this property has no effect.
In unbound mode, you can also sort data using the method.
Gets or sets whether the last column should be extended to fill the control.
This property only affects painting. It does not modify the
property of the last column.
Gets or sets the row that contains the cursor.
Use the and properties to make a cell current or to find
out which row or column contains the current cell. Columns and rows are
numbered from zero, beginning at the top for rows and at the left for columns.
The property may be set to -1 to hide the selection, to a value
between zero and Rows.Fixed-1 to select a cell in a fixed row, or to a value between
Rows.Fixed and Rows.Count-1 to select a cell in a scrollable row.
Setting the Row and Col properties automatically collapses the selection to a
single cell, resetting the and properties.
To specify a block selection, you must set Row and Col, then RowSel and ColSel. Alternatively,
you can use the method to select an arbitrary range with a single statement.
Setting the Row and Col properties does not ensure that the current cell is visible.
To do that, use the method.
Gets or sets the column that contains the cursor.
Use the and properties to make a cell current or to find
out which row or column contains the current cell. Columns and rows are
numbered from zero, beginning at the top for rows and at the left for columns.
The property may be set to -1 to hide the selection, to a value
between zero and Cols.Fixed-1 to select a cell in a fixed column, or to a value between
Cols.Fixed and Cols.Count-1 to select a cell in a scrollable column.
Setting the Row and Col properties automatically collapses the selection to a
single cell, resetting the and properties.
To specify a block selection, you must set Row and Col, then RowSel and ColSel. Alternatively,
you can use the method to select an arbitrary range with a single statement.
Setting the Row and Col properties does not ensure that the current cell is visible.
To do that, use the method.
Gets or sets the last row in the current selection.
Use the and properties to modify a
selection or to determine which cells are currently selected. Columns and rows are
numbered from zero, beginning at the top for rows and at the left for columns.
Setting the and properties automatically
collapses the selection to a single cell, resetting the RowSel and ColSel properties.
Therefore, to specify a block selection, you must Row and Col, then RowSel and ColSel.
Alternatively, you may use the method to select a range with a
single statement.
If the property is set to ,
you should use the property on individual row objects to
select and deselect rows.
When a range is selected, the value of may be greater than or
less than , and may be greater than or less than .
This is inconvenient when you need to set up bounds for loops. In these cases, you can
use the property to retrieve a normalized
object, where r1 <= r2 and c1 <= c2.
See the property for an example.
Gets or sets the last column in the current selection.
Use the and properties to modify a
selection or to determine which cells are currently selected. Columns and rows are
numbered from zero, beginning at the top for rows and at the left for columns.
Setting the and properties automatically
collapses the selection to a single cell, resetting the RowSel and ColSel properties.
Therefore, to specify a block selection, you must Row and Col, then RowSel and ColSel.
Alternatively, you may use the method to select a range with a
single statement.
When a range is selected, the value of may be greater than or
less than , and may be greater than or less than .
This is inconvenient when you need to set up bounds for loops. In these cases, you can
use the property to retrieve a normalized
object, where r1 <= r2 and c1 <= c2.
The code below loops though the cells in the current selection:
CellRange rg = flex.Selection;
for (int r = rg.r1; r <= rg.r2; r++)
for (int c = rg.c1; c <= rg.c2; c++)
Console.WriteLine("the value at {0} {1} is {2}", r, c, flex[r, c]);
Gets the collection of objects in the grid.
The property returns a reference to the list of rows
that make up the grid. With this reference, you can add, remove, move,
and count the rows. For more information on the tasks that can be performed
with this collection, see the object.
This property is read-only. The grid creates and manages the row collection for you.
Upgrade Note: In the VSFlexGrid ActiveX control, the Rows and FixedRows properties
corresponded to the number of rows and fixed rows on the grid. In C1FlexGrid, use Rows.Count
and Rows.Fixed.
Gets the collection of objects in the grid.
The property returns a reference to the list of columns
that make up the grid. With this reference, you can add, remove, move,
and count the columns. For more information on the tasks that can be performed
with this collection, see the object.
This property is read-only. The grid creates and manages the column collection for you.
Upgrade Note: In the VSFlexGrid ActiveX control, the Cols and FixedCols properties
corresponded to the number of columns and fixed columns on the grid. In C1FlexGrid, use
Cols.Count and Cols.Fixed instead.
Gets or sets the first visible column in the scrollable area.
Setting the property causes the grid to scroll horizontally
so that the given column becomes the leftmost visible column. This is often useful when
you want to synchronize two or more grids so that when one of them scrolls, the other
scrolls as well. To scroll vertically, use the property.
When setting this property, the largest possible column number is the total
number of columns minus the number of columns that will fit the display. Attempting
to set to a greater value will cause the grid to set it to the
largest possible value (no error will occur).
The value returned by the and properties
may correspond to partially visible rows or columns.
Use the and properties to scroll using
cells as units. Use the property to scroll the grid using
pixel units.
To ensure that a given cell is visible, use the method.
Gets or sets the first visible row in the scrollable area.
Setting the property causes the grid to scroll vertically
so that the given row becomes the topmost visible row. This is often useful when
you want to synchronize two or more grids so that when one of them scrolls, the other
scrolls as well. To scroll horizontally, use the property.
When setting this property, the largest possible row number is the total
number of rows minus the number of rows that will fit the display. Attempting
to set to a greater value will cause the grid to set it to the
largest possible value (no error will occur).
The value returned by the and properties
may correspond to partially visible rows or columns.
Use the and properties to scroll using
cells as units. Use the property to scroll the grid using
pixel units.
To ensure that a given cell is visible, use the method.
Gets the last visible column in the scrollable area.
The index returned may correspond to a column that is only partially visible.
This property is read-only. To scroll the contents of the grid, see the
, , and properties.
To ensure that a cell is visible, use the method.
Gets the last visible row in the scrollable area.
The index returned may correspond to a row that is only partially visible.
This property is read-only. To scroll the contents of the grid, see the
, , and properties.
To ensure that a cell is visible, use the method.
Assigns a value to a grid cell.
Row index.
Column index.
Value to assign to the cell.
Whether the value should be converted to the column's data type.
True if the value was assigned to the cell.
If is set to true and the value can't be converted into
the proper data type, the grid will fire the event and the
cell will retain its original value.
Using with set to true is equivalent
to setting the grid's indexer. For example, the following lines of code are equivalent:
flex.SetData(1, 1, "Hello", true);
flex[1, 1] = "Hello"; // same thing
Assigns a value to a range of cells.
that specifies the cells that will be assigned a new value.
Value that will be assigned to all cells in the range.
Whether the value should be converted to the column's data type.
True if the value was assigned to all cells in the destination range.
Assigns a value to a grid cell, coercing the value into the cell's specified DataType.
Row index.
Column index.
Value to assign to the cell.
True if the value was assigned to the cell, false if the value could not be
assigned (usually because it could not be converted to the appropriate type).
Assigns a value to a range of cells, coercing the value into each cell's specified DataType.
that specifies the cells that will be assigned a new value.
Value that will be assigned to all cells in the range.
True if the value was assigned to all cells in the destination range, false if
the value could not be assigned to all cells in the range (usually because it could not be
converted to the appropriate type).
Assigns a value to a grid cell.
Row index.
Column name.
Value to assign to the cell.
Whether the value should be converted to the column's data type.
True if the value was assigned to the cell, False otherwise.
If is set to true and the value can't be converted into
the proper data type, the grid will fire the event and the
cell will retain its original value.
Using with set to true is equivalent
to setting the grid's indexer. For example, the following lines of code are equivalent:
flex.SetData(1, "ColName", "Hello", true);
flex[1, "ColName"] = "Hello"; // same thing
Assigns a value to a grid cell, coercing the value into the cell's specified data type.
Row index.
Column name.
Value to assign to the cell.
True if the value was assigned to the cell, False otherwise.
Assigns a value to a grid cell, optionally coercing the value into the cell's specified data type.
Row index.
Column index.
Data to be applied to the cell.
Whether to coerce the value into the cell's specified data type.
True if the value was assigned to the cell, False otherwise.
Gets the value of a grid cell.
Row index.
Column index.
The value of the cell.
The method returns the raw data stored in a specific grid cell.
It is equivalent to using the grid's indexer. For example:
object foo = flex.GetData(1, 1);
object bar = flex[1, 1]; // same thing
The data displayed on the grid might be different from the raw data, depending on
the setting of the and properties.
To obtain the display value (which is always a string), use the
method instead.
Gets the value of a grid cell, taking into account the value returned by the method.
Row index.
Column index.
Whether to take into account the value of the method.
Gets the value of a grid cell.
Row index.
Column name.
The value of the cell.
Gets user data associated with a cell.
Row index.
Column index.
Object associated with the cell.
The user data is not used internally by the grid. It is reserved for additional data that you may want to
associate with a cell.
Gets user data associated with a cell.
Row index.
Column name.
Object associated with the cell.
The user data is not used internally by the grid. It is reserved for additional data that you may want to
associate with a cell.
Assigns user data to a cell.
Row index.
Column index.
User data to assign to the cell.
The user data is not used internally by the grid. It is reserved for
additional data that you may want to associate with a cell.
Assigns user data to a cell.
Row index.
Column name.
User data to assign to the cell.
The user data is not used internally by the grid. It is reserved for additional data that you may want to
associate with a cell.
Gets the value in a grid cell, formatted as a string.
Row index.
Column index.
A string containing the data displayed in the given grid cell.
Gets the value in a grid cell, formatted as a string.
Row index.
Column name.
A string containing the data displayed in the given grid cell.
Gets the value in a grid cell, formatted as a string, and the image or checkbox in the cell.
Row index.
Column index.
Returns the image in the cell.
Returns the checkbox value in the cell.
A string containing the data displayed in the given grid cell.
This method provides a way to retrieve all the data that is displayed in a cell with a single call.
The image returned in the parameter may be an image assigned to the
cell using the method, a mapped value obtained through an ,
or an image stored as cell data (when the cell's is set to Image).
The value returned in the parameter is the value
returned by the method.
Gets the value in a grid cell, formatted as a string, and the image or checkbox in the cell.
Row index.
Column name.
Returns the image in the cell.
Returns the checkbox value in the cell.
A string containing the data displayed in the given grid cell.
This method provides a way to retrieve all the data that is displayed in a cell with a single call.
The image returned in the parameter may be an image assigned to the
cell using the method, a mapped value obtained through an ,
or an image stored as cell data (when the cell's is set to Image).
The value returned in the parameter is the value
returned by the method.
Gets or sets the grid's selection behavior.
In most selection modes, you can obtain the current selection using the
property.
When is set to ,
however, the selection may consist of a non-continuous range of rows. In this case,
you can check the selection state of individual rows using the
property or obtain a collection of selected rows using the property.
Selects a range of cells.
that specifies the cells that will be selected.
Whether to scroll the new selection into view.
Selects a range of cells and scrolls it into view.
that specifies the cells that will be selected.
Selects a range of cells.
New value for the property.
New value for the property.
New value for the property.
New value for the property.
Whether to scroll the new selection into view.
Using the method is equivalent to setting the ,
, , and properties.
Selects a range of cells and scrolls it into view.
New value for the property.
New value for the property.
New value for the property.
New value for the property.
Using the method is equivalent to setting the ,
, , and properties.
Selects a cell.
New value for the property.
New value for the property.
Whether to scroll the new selection into view.
Using the method is equivalent to setting the and properties.
Selects a cell and scrolls it into view.
New value for the property.
New value for the property.
Using the method is equivalent to setting the and properties.
Sorts the grid contents based on a column.
value that specifies the sort direction and options.
Column to sort on.
Sorting works differently depending on whether the grid is bound to a data source or not.
In bound mode, the grid passes the sort request to the underlying data source object. In this case,
the sort settings remain in effect as the grid data changes. Editing values in the sort column will cause
the data source to re-sort the data, and grid will show the changes automatically. This is equivalent to
setting the property on a object for example.
In unbound mode, the Sort method sorts the data that is currently stored in the grid. Changing
the data after it has been sorted will not automatically update the sort.
When the grid is bound to a new data source, it inherits the sort settings currently applied to the
new data source object. Because of this, calling Sort immediately before setting the
property has no effect on the grid.
In unbound mode, the grid uses a stable sorting algorithm. This means that the sorting keeps the
relative order of records when the sorting key is the same. For example, if you sort a list of files by
name, then by extension, the list will still be sorted by name within each extension group.
The grid recognizes two types of row: regular rows which contain data, and node rows which are used
to group data. The Sort method only sorts regular rows; it does not affect node rows at all.
To sort nodes, use the method in the property or the
method in the class.
Sorts the grid contents based on a column range.
value that specifies the sort direction and options.
First column in the range.
Last column in the range.
When you sort multiple columns, the same sorting options are applied to each column,
starting from the leftmost column in the range and proceeding to the right.
To sort multiple columns using a different sorting order for each, you can either
call the method multiple times or set each column's
property and call the method including the
flag in the parameter.
Sorts a range of cells in the grid.
value that specifies the sort direction and options.
object that specifies the range of cells to sort.
When you sort multiple columns, the same sorting options are applied to each column,
starting from the leftmost column in the range and proceeding to the right.
To sort multiple columns using a different sorting order for each, you can either
call the method multiple times or set each column's
property and call the method including the
flag in the flags parameter.
Sorts a group of rows using the specified comparer.
First row in the sort range.
Number of rows in the sort range.
An object that compares objects.
The interface has a single method called that
takes two objects as arguments (in this case, they will be objects) and
returns -1, 0, or +1. For more details, see the documentation for .
Custom sorting can only be used when the grid is in unbound mode.
Sorts the grid using the specified comparer.
An object that compares objects.
The interface has a single method called that
takes two objects as arguments (in this case, they will be objects) and
returns -1, 0, or +1. For more details, see the documentation for .
Custom sorting can only be used when the grid is in unbound mode.
Shows the sorting glyph on a column header.
value that specifies the glyph to display.
Column index.
This method is useful if you want to perform custom sorting and need control over the appearance
and position of the sorting glyph (the little triangle that appears on the header of sorted columns).
Gets the selected range in normalized form.
The range returned corresponds to the current selection, defined by the , ,
, and properties.
The range is normalized, so range.r1 <= range.r2 and range.c1 <= range.c2. This makes
it easy to loop through the selection. For example:
int total = 0;
CellRange rg = flex.Selection;
for (int r = rg.r1; r <= rg.r2; r++)
for (int c = rg.c1; c <= rg.c2; c++)
total += (int)flex[r,c];
Console.WriteLine("The total is: {0}", total);
Gets a object that contains the cell at coordinates , .
To get a object that spans the entire selection, use the property.
Scrolls a cell into view.
Row index.
Column index.
This method does not affect the current selection. To move the cursor to a specific cell
and optionally bring it into view, use the method.
Invalidates the control.
Invalidates a cell, causing it to be repainted.
Row index.
Column index.
This method is rarely used by the programmer, since the grid automatically performs invalidation as needed.
Invalidates a cell range, causing it to be repainted.
Top row in the range.
Left column in the range.
Bottom row in the range.
Right column in the range.
Invalidates a cell range, causing it to be repainted.
that will be invalidated.
This method is rarely used by the programmer, since the grid automatically
performs invalidation as needed.
Gets the collection of cell styles defined in the grid.
The property enables you to obtain a reference to the list of
styles that are currently defined in the grid. With this reference, you can add, remove,
and count the styles. For more information on the tasks that can be performed with this
collection, see the class reference topics. For information
on cell formatting, see the reference topics.
This property is read-only. The grid creates and manages the collection for you.
Upgrade Note: The VSFlexGrid ActiveX control had many properties that affected the way
the grid was displayed (e.g. BackColor, BackColorAlternate, BackColorBkg, BackColorFixed,
BackColorFrozen, BackColorSel, and so on). The C1FlexGrid control replaces all these
properties with a collection of objects. This makes the object
model simpler, more consistent, and more powerful. You can change the built-in styles or
define your own, and assign them to rows, columns, or arbitrary cell ranges.
Gets or sets whether the grid should move the cursor searching for entries as the user types.
If is on, the grid will search the current column as the user
types, automatically moving the cursor and highlighting matches using the style.
The search is case-insensitive. The search is canceled when the user presses the ESC key or
moves the selection with the mouse or cursor keys.
When the user stops typing for about a second, the search buffer is reset. This amount of
time can be changed by setting the property.
If is on and is set to true, the user
will need to hit ENTER, or F2 to start editing cells. Other keys are used for searching.
Gets or sets the delay (in seconds) before the buffer is reset.
See the property for details.
Gets or sets the action to be performed when the user presses the ENTER key.
By default, the grid will move the selection down to the next visible row when the
user presses the ENTER key. If the grid is editable, pressing ENTER will cause the grid
to enter edit mode, and pressing ENTER while in edit mode will cause the cursor to move down.
This property allows you to modify this behavior and disable cell navigation with the
ENTER key, or cause it to move the selection to the next column instead of row.
Note that the and as
settings have the same effect when applied to this property. Pressing the ENTER key will
move the selection within the grid, but will not move the focus to the next control on the form.
Gets or sets the action to be performed when the user presses the TAB key.
By default, the grid will ignore the TAB key and it will be handled by the form, moving the focus to
the next control in the tab order. If you set the property to a value
other than , the grid will trap the TAB key and use it for navigating cells.
Gets or sets the image to be used in cell buttons.
This property allows you to customize the appearance of cell buttons. For details on how to
create and handle cell buttons, see the event.
If you want to use a single picture for all cell buttons on the grid, assign the picture to the
property at design time. To change pictures depending on the row, column, or cell
being edited, set the picture in response to the event.
The pictures used for cell buttons should fit within the button (larger pictures are truncated).
They should also be transparent, so the button face can be seen through the empty parts of the picture.
For best results, use small icons (16 x 16 pixels) and draw the picture in the upper left 12 x 12
rectangle within the icon.
Gets the index of the row under the cursor.
The and properties are often useful when
handling the event, to provide custom mouse handling.
They are also useful when handling mouse events that do not change the selection and for
detecting clicks on the fixed areas of the grid.
Typical uses for these properties include displaying help information or tooltips when
the user moves the mouse over a selection, and the implementation of manual drag-and-drop
manipulation of OLE objects.
and return -1 if the mouse is not over
any rows or columns.
To obtain more detailed hit-testing information, use the method.
Gets the index of the column under the cursor.
The and properties are often useful when
handling the event, to provide custom mouse handling.
They are also useful when handling mouse events that do not change the selection and for
detecting clicks on the fixed areas of the grid.
Typical uses for these properties include displaying help information or tooltips when
the user moves the mouse over a selection, and the implementation of manual drag-and-drop
manipulation of OLE objects.
and return -1 if the mouse is not over
any rows or columns.
To obtain more detailed hit-testing information, use the method.
Returns information about the control at a specified point on the control surface.
The horizontal position of the client coordinate.
The vertical position of the client coordinate.
A object that contains information about the point.
This method is especially useful when handling the event.
It allows you to determine whether the mouse is over a specific cell, grid buttons,
resizing elements, etc.
The code below shows hit test information whenever the user clicks the mouse:
void _flex_BeforeMouseDown(object sender, BeforeMouseDownEventArgs e)
{
HitTestInfo hti = _flex.HitTest(e.X, e.Y);
Console.WriteLine("at {0},{1}: row {2} col {3} type {4}",
hti.X, hti.Y, hti.Row, hti.Column, hti.Type);
}
Returns information about the control at a specified point on the control surface.
in client coordinates.
A object that contains information about the point.
This method is especially useful when handling the event.
It allows you to determine whether the mouse is over a specific cell, grid buttons,
resizing elements, etc.
Returns information about the control at the current mouse position.
A object that contains information about the point.
Gets a object with the coordinates of the cell within the control.
Row index.
Column index.
Whether to scroll the cell into view before calculating the rectangle.
A object with the coordinates of the cell, in pixels and
relative to the control's client area.
This property is useful if you need to implement custom editors or other elements that need
to be positioned over cells.
Gets a object with the coordinates of the cell within the control.
Row index.
Column index.
This property is useful if you need to implement custom editors or other elements that need
to be positioned over cells.
This method does not ensure the cell is visible.
Finds a row that contains a specified string.
String to look for.
Index of the row where the search should start.
Column that contains the data to be searched.
Whether the search should be case-sensitive.
Whether a full match is required. If this parameter is set to false, searching for "John" may return a row that contains "Johnson".
Whether the search should stop at the bottom of the grid or wrap around and restart from the first scrollable row.
The index of the row that contains the string, or -1 if the string is not found.
To allow users to search for data as they type, use the property.
Finds a row that contains a specified value in a given column.
Object to look for.
Index of the row where the search should start.
Column to be searched.
Whether the search should stop at the bottom of the grid or wrap around and restart from the first scrollable row.
The index of the row that contains the data, or -1 if the object is not found.
Finds a row that contains a specified value in a given column using a RegularExpression.
The regular expression pattern to match.
Index of the row where the search should start.
Column that contains the data to be searched.
Whether the search should stop at the bottom of the grid or wrap around and restart from the first scrollable row.
The index of the row that matches the pattern, or -1 if no matches were found.
The parameter specifies a regular expression pattern
expressed in the usual syntax.
The regular expression syntax supports character classes, ranges, repeat counts,
alternate matches, and more. Please refer to the .NET documentation for details and examples.
Gets or sets whether the grid should paint its contents.
This property is deprecated. Use the and
methods instead.
Maintains performance by preventing the control from updating itself until
the method is called.
The and methods are used to
optimize the performance of the grid. Call before making
extensive changes, and call when done to suspend repainting.
This will reduce flicker and increase performance. This optimization is especially
effective when adding large numbers of rows to the grid, because it needs to
recalculate ranges and update scrollbars each time a row is added.
The code below shows how to add a large number of rows to the grid efficiently.
Note how the method is called inside a 'finally' block
to ensure repainting is properly restored.
void UpdateGrid(C1FlexGrid flex)
{
try
{
flex.BeginUpdate(); // suspend painting to avoid flicker
flex.Rows.Count = 1;
for (int i = 1; i < 10000; i++)
flex.AddItem("Row " + i.ToString());
}
finally
{
flex.EndUpdate(); // always restore painting
}
}
Resumes updating the control after calls to the method.
Gets or sets whether the control should fire the event.
If you set this property to , the grid will
fire the event whenever a cell needs to be painted.
You can handle the event and customize the way each cell is painted, either by changing
the cell contents and style, or by taking over the painting and doing it yourself.
For more details and examples, see the event.
Gets or sets whether the control should use an off-screen buffer when painting to reduce flicker.
This property is set to true by default, and rarely needs to be changed.
Setting to false may increase performance of applications
running under terminal server software.
Gets or sets the characters used as row and column separators in clip strings.
For details and an example, see the property.
Gets or sets the contents of the selected range.
The string assigned to (or returned by) the property may contain
multiple cells. By default, tab characters (\t) indicate column breaks, and carriage return
characters (\n) indicate row breaks.
The default row and column delimiters may be changed using the property.
When a string is assigned to the property, only the selected
cells are affected. If there are more cells in the selected region than are described in the
clip string, the remaining cells are ignored. If there are more cells described in the clip
string than in the selected region, the extra portion of the clip string is ignored. Empty
entries in the string will clear existing cell contents.
To get or set a clip string for an arbitrary range, use a object.
The value returned is affected by the setting of the
property.
The code below puts text into a selected area two rows high and two columns wide.
// build clip string
string s = "r1 c1\tr1 c2\nr2 c1\tr2 c2";
// select a 2 x 2 range and apply clip string to selection
flex.Select(2, 2, 4, 4);
flex.Clip = s;
Clears a range.
value that specifies the elements to clear.
Range to clear.
Clears a range.
value that specifies the elements to clear.
Top row in the range.
Left column in the range.
Bottom row in the range.
Right column in the range.
Clears a cell.
value that specifies the elements to clear.
Row index.
Column index.
Clears the grid.
value that specifies the elements to clear.
The method does not affect the number of rows and columns on the grid,
and can't be used to clear data when the grid is bound to a data source.
Clears the grid.
This method removes all data, styles, and user data from all cells, rows, and columns on the grid.
The method does not affect the number of rows and columns on the grid,
and can't be used to clear data when the grid is bound to a data source.
Gets a object that can be used to format and manipulate a cell.
Row index.
Column index.
A object that can be used to format and manipulate the cell.
Gets a object that can be used to format and manipulate a range.
Top row in the range.
Left column in the range.
Bottom row in the range.
Right column in the range.
A object that can be used to format and manipulate the range.
The object provides access to properties of the cells in the range.
For example, the code below sets the style of a range:
CellRange rg = flex.GetCellRange(5, 5, 20, 8);
rg.Style = flex.Styles["MyStyle"];
Note: is a class, not a struct. Because of this, you have to
assign the value to a variable and then use the variable. For example, the following code
will not compile:
// this does not compile
flex.GetCellRange(5, 5, 20, 8).Style = flex.Styles["MyStyle"];
Creates an image of the entire grid.
An object containing a metafile image of the grid.
Use this method to copy grid images to the clipboard so you can paste them into
documents or other applications.
The code below creates an image of a grid range and saves it to a PNG file that can be
included in other documents such as web pages:
Image img = flex.CreateImage(0,0,10,5);
img.Save(@"c:\temp\grid.png", System.Drawing.Imaging.ImageFormat.Png);
Creates an image of a portion of the grid.
Top row in the range.
Left column in the range.
Bottom row in the range.
Right column in the range.
An object containing a metafile image of the grid.
The image returned includes any fixed and frozen cells in addition to the specified range.
Creates an image of a portion of the grid.
that specifies which cells should be included in the image.
An object containing a metafile image of the grid.
The image returned includes any fixed and frozen cells in addition to the specified range.
Creates an image of a portion of the grid.
Top row in the range.
Left column in the range.
Bottom row in the range.
Right column in the range.
value that determines the type of metafile to create.
An object containing a metafile image of the grid.
The image returned includes any fixed and frozen cells in addition to the specified range.
Creates an image of a portion of the grid.
that specifies which cells should be included in the image.
value that determines the type of metafile to create.
An object containing a metafile image of the grid.
The image returned includes any fixed and frozen cells in addition to the specified range.
Draws a grid cell.
object where the cell will be drawn.
Index of the cell's row.
Index of the cell's column.
that defines the cell position.
This method is for internal use. It allows inherited classes to customize the grid appearance.
Gets or sets a reference to the cell editor that is currently active.
The property returns a reference to the cell editor that is
currently active. This may be one of the built-in editors (a TextBox, a ComboBox, or a
DateTimePicker control), a custom editor, or null (if the grid is not in edit mode).
You can use this property to programmatically access the editor, or to find out
if the grid is in edit mode.
If you don't want to use the grid's built-in editors, you can use any other control
instead. To do this, either associate the external editor with a specific grid row, column,
or using the property, which you can
get and set at any time.
Alternatively, you can handle the event and assign any control
directly to the property. (Note that the grid's Editor property can only
be assigned while handling the event, and is automatically reset to
null when the grid exits edit mode.)
Any control can be used as an external editor, but to achieve complete integration with
the grid, the external editor should implement the IC1EmbeddedEditor interface. Some controls
implement this interface natively and don't require any extra code to be used as grid editors
(like the ones in the C1Input library). Most, however, will require you to implement at least
a few of the methods in IC1EmbeddedEditor.
For examples of custom editors, please see Using Custom Editors and Creating Custom Editors
in this documentation, or visit our on-line sample library at https://www.grapecity.com/en/samples
and download the "CustomEditors" sample.
The code below uses the event to customize the current editor
by setting two properties.
void _flex_SetupEditor(object sender, C1.Win.C1FlexGrid.RowColEventArgs e)
{
TextBox tb = _flex.Editor as TextBox;
if (tb != null)
{
tb.CharacterCasing = CharacterCasing.Upper;
tb.MaxLength = 12;
}
}
If True then empty strings from editor are interpreted as null values.
Gets or sets the list of items to be used by the drop-down editor.
The property specifies the type of editor to be used when
editing a cell. You may use a text box, drop-down list, drop-down combo, or an edit button
to pop up custom editor forms.
To use the property, set the property
to true and respond to the event by setting the
property to a string that describes the type of editing you want to use for that cell.
The options are described below:
1. To edit the cell using a regular text box, set the property to an empty string.
For example:
flex.ComboList = string.Empty;
2. To edit the cell using a drop-down list, set the property to a string containing the
available options, separated by pipe characters. For example:
flex.ComboList = "Item 1|Item 2|Item 3";
3. To edit the cell using a drop-down combo, set the property to a string containing the
available options, separated by pipe characters ("|") and starting with a pipe character. For example:
flex.ComboList = "|Item 1|Item 2|Item 3";
4. To display an edit button, set the property to a string containing an ellipsis ("...").
Edit buttons look like regular push buttons, aligned to the right of the cell, with an ellipsis as a caption.
When the user clicks on the edit button, the grid fires the CellButtonClick event. In this case, the user can't
edit the cell contents directly. For example:
flex.ComboList = "...";
5. To display an edit button next to an editable cell, set the property to a string
containing a pipe and an ellipsis ("|..."). In this case, you get a regular edit button but the user can also edit the
cell contents directly. For example:
flex.ComboList = "|...";
The property is especially useful in cases where different rows in
the same column may contain different types of data (for example a control such as the PropertyGrid).
In this case, the property allows you to adjust the type of editing you
want to provide depending on the current row.
If all rows in the column contain the same type of data, use the Column's
property instead. This way, the grid will automatically select the list depending on the column
being edited and you don't need to handle any events.
Note that the ComboList allows you to specify lists of strings only. Cells will store and display
these strings. If you want to store a certain type of data and display values associated with that data, see
the property. The DataMap property allows you to store values in the cells
(for example a CustomerID) and display strings associated with that data (for example the customer name).
The code below handles the event and assigns a value to the
property so that the grid displays buttons on every other row.
void _flex_BeforeEdit(object sender, RowColEventArgs e)
{
_flex.ComboList = string.Empty;
if (e.Row % 2 == 0) _flex.ComboList = "...";
}
Gets or sets the input mask to use when editing cells.
The specifies an input mask for automatic input formatting and
validation. The mask syntax is similar to the one used by the Microsoft MaskedEdit ActiveX
control and by Microsoft Access and is described below.
Set the property in response to the event,
in the same way you would set the property.
If the same mask is used to edit all values in a column, use the column's
property. This simplifies your code because you don't need to handle the event.
When the user is done editing a cell with a mask, the event fires.
The event parameter will be set to true if the mask was not filled
out properly, so in most cases you don't have to implement the handler. The default behavior ensures that
only valid data will be entered.
The string is composed of the following symbols:
1) Wildcards
0 digit
9 digit or space
# digit, space, or sign
L letter
? letter or space
A letter or digit
a letter, digit, or space
& any character
2) Localized characters
. localized decimal separator
, localized thousand separator
: localized time separator
/ localized date separator
3) Command characters
\ next character is taken as a literal
> translate letters to uppercase
< translate letters to lowercase
4) Placeholder specification
; next character is used as a placeholder (the default is an underscore)
The code below sets the edit mask so the user can enter a phone number, with optional
area code, and a state in uppercase letters. The space-holder used is an asterisk ("*").
flex.EditMask = "(###) 000-0000 St\ate\: >LL;*";
Puts the grid in edit mode and starts editing a cell.
Row index.
Column index.
Initial character to be sent to the editor.
True if the grid entered edit mode successfully, false otherwise.
Puts the grid in edit mode and starts editing a cell.
Row index.
Column index.
True if the grid entered edit mode successfully, false otherwise.
Puts the grid in edit mode and starts editing the current cell.
True if the grid entered edit mode successfully, false otherwise.
If the property is set to true, the control goes into
edit mode automatically when the user presses the edit key (F2), the space bar, or
any printable character. You may use the method to force
the control into cell-editing mode.
The method forces the control into editing mode even
if is set to False. You may also use it to allow editing of
fixed cells.
The code below uses the method to keep the grid in edit mode
while the user moves the selection (like the .NET DataGrid control):
void _flex_RowColChange(object sender, System.EventArgs e)
{
_flex.StartEditing();
}
Finishes editing the current cell and takes the grid out of edit mode.
True if the grid left edit mode successfully, false otherwise.
Finishes editing the current cell and takes the grid out of edit mode,
optionally canceling the edits.
Whether to cancel the current edits and revert the cell to its original value.
True if the grid left edit mode successfully, false otherwise.
If the cancel parameter is set to false, the grid tries to apply the edits,
and fires the , , and events as usual.
If validation fails, the grid stays in edit mode (and returns false).
If the cancel parameter is set to true, the original cell value is restored and the
grid is guaranteed to leave the edit mode. In this case, only the event fires.
To determine whether the grid is in edit mode, check whether the property is null.
Starts editing a cell in response to a key press.
This method is for internal use. It allows inherited classes to customize the editing process.
Row index.
Column index.
Key that initiated the edit process.
Whether editing should start even in non-editable cells (e.g. fixed cells).
True if the editing process was started successfully, false otherwise.
Starts editing a cell in response to a mouse action.
This method is for internal use. It allows inherited classes to customize the editing process.
Row index.
Column index.
Mouse position in client coordinates.
Whether the action was a double-click.
True if the editing process was started successfully, false otherwise.
Gets a reference to the object that controls the appearance
of the outline tree in the grid.
The can group data hierarchically and display it with a
collapsible tree similar to the one in the Microsoft TreeView control.
The object is used to specify the position and appearance
of the outline tree.
For details on create outlines, see the method and
the property.
Gets an array containing all zero-level
rows on the grid.
Gets or sets the specific list in a object that the grid should display.
If a contains multiple sources of data, you should set the
property to one of the sources.
For example, if the DataSource is a contains three tables named Customers,
Orders, and OrderDetails, you must specify one of the tables to bind to.
If the contains only one , you may set the
DataMember property to an empty string.
You can use the method to set the
and properties at the same time.
Gets or sets the data source for the grid.
Any object that implements the or
interfaces can be used as a data source.
Specifically, the following ADO.NET data sources are valid: DataTable, DataView,
DataSet, and DataViewManager.
The following ComponentOne DataObjects components are also valid data sources:
C1ExpressTable, C1ExpressVew, C1ExpressConnection, C1DataView, C1DataTableSource, and C1DataSet.
If the reference contains more than one table, you must
also set the property a string that specifies the table to bind to.
For example, if the DataSource is a DataSet or DataViewManager that contains three tables named
Customers, Orders, and OrderDetails, you must specify one of the tables to bind to.
You can use the method to set the
and properties simultaneously.
You can also assign another object to the
property. In this case, the controls will share the same grid model, including the data, display styles,
selection, etc. This can be used to implement split views, where different controls display different
parts of the same data.
Sets the and properties.
The new data source object.
The table to bind to within the data source object.
Sets the and properties,
optionally keeping the current column layout.
The new data source object.
The table to bind to within the data source object.
Whether the current column layout should be preserved or re-generated
automatically based on the data source schema.
Gets or sets whether column widths are automatically adjusted when data is loaded.
This property works when the control is bound to a .
If is set to true, the control automatically resizes its
columns to fit the widest entry every time new data is read from the data source.
If the data source contains a large number of rows and columns, the automatic
resizing may take a relatively long time. In these cases, you should consider setting
to false and setting the column widths directly in code.
You may also use the method to adjust the column widths
automatically.
Gets or sets whether columns are automatically created when the grid is bound to a data source.
By default, assigning a new to the grid resets the column collection
to reflect the data source schema. If you set to false, the
existing column layout will be preserved.
Calculates aggregate statistics for a range.
value that specifies the type of aggregate to calculate.
object that contains the values to be aggregated.
value that specifies aggregation options.
A that represents the aggregate value.
Calculates aggregate statistics for a range.
value that specifies the type of aggregate to calculate.
Top row in the range.
Left column in the range.
Bottom row in the range.
Right column in the range.
value that specifies aggregation options.
A that represents the aggregate value.
Calculates aggregate statistics for the current selection.
value that specifies the type of aggregate to calculate.
value that specifies aggregation options.
A that represents the aggregate value.
Calculates aggregate statistics for the current selection.
value that specifies the type of aggregate to calculate.
A that represents the aggregate value.
The code below method to calculate aggregate statistics
for the current selection. Whenever the selection changes, new aggregates are
calculated and written to the console.
void flex_SelChange(object sender, System.EventArgs e)
{
string fmt = "Count {0:0}, Sum {1:#,##0.00}, " +
"Avg {2:#,##0.00}, Stdev {3:#,##0.00}";
Console.WriteLine(fmt,
flex.Aggregate(AggregateEnum.Count),
flex.Aggregate(AggregateEnum.Sum),
flex.Aggregate(AggregateEnum.Average),
flex.Aggregate(AggregateEnum.Std));
}
Calculates aggregate statistics for a range.
value that specifies the type of aggregate to calculate.
object that contains the values to be aggregated.
A that represents the aggregate value.
Calculates aggregate statistics for a range.
value that specifies the type of aggregate to calculate.
Top row in the range.
Left column in the range.
Bottom row in the range.
Right column in the range.
A that represents the aggregate value.
Groups rows based on cell contents and calculates aggregate values.
value that specifies the type of aggregate to calculate.
Outline level to assign to the new subtotal rows. This parameter allows the creation of multi-level subtotals and affects the display of the outline tree.
First column in the range used to detect group breaks.
Last column in the range used to detect group breaks.
Column that contains values to be aggregated (usually numeric).
Text to insert in the subtotal rows.
The method inserts rows containing aggregate values. These new rows are set
to behave as tree nodes so they can be collapsed and expanded to display a dynamic hierarchical
outline.
You can control the appearance and behavior of the outline tree using the property.
The node rows added by the method have their property
automatically set to one of the Styles.Subtotal* styles. You can use the
collection to modify the appearance of all subtotal rows on the grid.
To create an outline tree manually, insert node rows using the method,
or convert regular rows into nodes by setting the property to true for the
node rows. Then use the property to set the outline level for the new
nodes.
The code below assumes a grid with four columns: "Product", "Region", "Employee", and "Sales".
The code groups on the first two columns, calculating total sales for each product and for
each region within each product.
If the user drags a column to a new position, the tree is automatically rebuilt to show
the new grouping (by Employee, Region, etc).
void UpdateTotals()
{
// no repainting until we're done
_flex.Redraw = false;
// clear old subtotals, if any
_flex.Subtotal(AggregateEnum.Clear);
// sort the grid on the columns that will be grouped
_flex.Sort(SortFlags.Ascending, 0, 3);
// show outline tree on column 0
_flex.Tree.Column = 0;
// get a grand total (use -1 instead of column index)
_flex.Subtotal(AggregateEnum.Sum, -1, -1, 3, "Grand Total");
// total on column 0 (initially Product)
_flex.Subtotal(AggregateEnum.Sum, 0, 0, 3);
// total on column 1 (initially Region)
_flex.Subtotal(AggregateEnum.Sum, 1, 1, 3);
// show outline level 1
_flex.Tree.Show(1);
// restore painting
_flex.Redraw = true;
}
void _flex_AfterDragColumn(object sender, C1.Win.C1FlexGrid.DragRowColEventArgs e)
{
UpdateTotals(); // user moved a column, update totals
}
Groups rows based on cell contents and calculates aggregate values.
value that specifies the type of aggregate to calculate.
Outline level to assign to the new subtotal rows. This parameter allows the creation of multi-level subtotals and affects the display of the outline tree.
Column used to detect group breaks.
Column that contains values to be aggregated (usually numeric).
Text to insert in the subtotal rows.
Groups rows based on cell contents and calculates aggregate values.
value that specifies the type of aggregate to calculate.
Outline level to assign to the new subtotal rows. This parameter allows the creation of multi-level subtotals and affects the display of the outline tree.
Column used to detect group breaks.
Column that contains values to be aggregated (usually numeric).
Groups rows based on cell contents and calculates aggregate values.
value that specifies the type of aggregate to calculate.
This version of the method does not take any column parameters,
and is useful only for clearing the subtotals. For example:
flex.Subtotal(AggregateEnum.Clear); // clear all subtotals
Groups rows based on cell contents and calculates aggregate values.
value that specifies the type of aggregate to calculate.
Outline level to assign to the new subtotal rows. This parameter allows the creation of multi-level subtotals and affects the display of the outline tree.
Name of the first column in the range used to detect group breaks.
Name of the last column in the range used to detect group breaks.
Name of the column that contains values to be aggregated (usually numeric).
Text to insert in the subtotal rows.
This is a variant of the method
that takes column names instead of indices.
Groups rows based on cell contents and calculates aggregate values.
value that specifies the type of aggregate to calculate.
Outline level to assign to the new subtotal rows. This parameter allows the creation of multi-level subtotals and affects the display of the outline tree.
Name column used to detect group breaks.
Name of the column that contains values to be aggregated (usually numeric).
Text to insert in the subtotal rows.
This is a variant of the method
that takes column names instead of indices.
Groups rows based on cell contents and calculates aggregate values.
value that specifies the type of aggregate to calculate.
Outline level to assign to the new subtotal rows. This parameter allows the creation of multi-level subtotals and affects the display of the outline tree.
Name column used to detect group breaks.
Name of the column that contains values to be aggregated (usually numeric).
This is a variant of the method
that takes column names instead of indices.
Gets or sets whether node rows appear above or below the data.
This property determines how the outline tree is drawn, and it also determines
whether the method should add subtotal rows (which are node rows)
above or below the data being summarized.
Changing this property clears any existing nodes.
Adds a row to the grid and populates the new row with data.
String containing the data for the new row. Items are separated by tab characters
by default. You can change the separator character using the property.
A reference to the new row.
You can also add and remove rows using the collection. The
method provides a concise syntax for creating the row, populating it with data, and then adding it to the grid.
Before using to add a large number of rows to the grid, remember to set the
property to false. When finished adding the rows, set back to
its original value. This will significantly improve performance.
The code below adds 300 rows to the grid.
// suspend painting to improve performance
bool redraw = flex.Redraw;
flex.Redraw = false;
// append 100 rows, using tabs as separators
flex.ClipSeparators = "\t\n";
for (int i = 0; i < 100; i++)
flex.AddItem("\tcol1\tcol2\tcol3");
// add 100 rows at the top, using pipes as separators
flex.ClipSeparators = "|;";
for (int i = 0; i < 100; i++)
flex.AddItem("|col1|col2|col3", 0);
// append 100 rows at the bottom, using an object array
object[] items = { "col1", "col2", "col3" };
for (int i = 0; i < 100; i++)
flex.AddItem(items, flex.Rows.Count, flex.Cols.Fixed);
// restore painting
flex.Redraw = redraw;
Adds a row to the grid and populates the new row with data.
Array of objects that will be assigned to the new row.
A reference to the new row.
Adds a row to the grid at a specified position and populates the new row with data.
String containing the data for the new row. Items are separated by tab characters
by default. You can change the separator character using the property.
Position where the new row will be inserted.
A reference to the new row.
Adds a row to the grid at a specified position and populates the new row with data.
Array of objects that will be assigned to the new row.
Position where the new row will be inserted.
First column to populate with the items in the
array. This parameter is usually set to the index of the first scrollable column.
A reference to the new row.
Removes the last row from the grid.
You can also add and remove rows using the collection.
The method is provided for consistency, since the grid
also has an method.
Removes a row at a specified position from the grid.
Index of the row to be removed.
Prints the grid, optionally showing a page setup or print preview dialog.
The document name, which appears on the progress dialogs and on the print job windows.
Flags that select printing options.
True if the grid was printed, false if the user canceled the operation before printing started.
Use the property to set up options such as page orientation
and margins, header and footer fonts, etc.
The method returns true if the user started the printing process. If the user clicks cancel while
the grid is printing, the method returns true (some pages may be printed anyway depending on the
printer settings). To detect canceled jobs, handle the event and check the
value of the e.Cancel parameter.
Prints the grid, optionally showing a page setup or print preview dialog.
The document name, which appears on the progress dialogs and on the print job windows.
Flags that select printing options.
String that appears on the top of every page.
String that appears on the bottom of every page.
True if the grid was printed, false if the user canceled the operation.
The header and footer strings may contain up to three tab-delimited sections, which are
aligned to the left, center, and right of the page. The strings may also contain placeholders
that are replaced with the current page number and total number of pages ("{0}" and "{1}").
Use the property to set up options such as page orientation
and margins, header and footer fonts, etc.
Prints the grid, optionally showing a page setup or print preview dialog.
The document name, which appears on the progress dialogs and on the print job windows.
True if the grid was printed, false if the user canceled the operation.
Use the property to set up options such as page orientation
and margins, header and footer fonts, etc.
Gets a object that specifies printing parameters for the grid.
Use the method to print the grid and specify the document name,
common printing options, headers and footers.
Use the property to specify less common printing options
such as header and footer fonts, page margins, and page orientation.
Gets or sets a value that determines if the control can accept data that the user drags onto it.
This property allows you to use the control as a target for OLE drag-drop operations.
If set to (the default value), the control does not act as a drop target.
If set to , the control fires the standard drag-drop events
and the programmer is responsible for handling them. The main events involved are and
. These events are provided by the standard System.Windows.Forms.Control object.
If set to , the control handles the and
events automatically by performing the following actions:
1) Query the data object for data in text or filename formats.
2) Scroll if the user drags an object near the edges of the control.
3) Paste the contents of the data object when the user drops valid data on the control.
Note: This property replaces and extends the property provided by the
base object.
Gets or sets a value that determines if the user can drag data from the control.
This property allows you to use the control as a source for OLE drag-drop operations. If
set to any of the automatic settings, the control provides the following services:
1) Detect when the mouse is near the edge of a selected cell or range and display the
OLE drag cursor.
2) If the user clicks the mouse while the OLE drag cursor is displayed, initiate a
drag operation with a data object containing the current selection.
In manual mode, the programmer is responsible for starting drag-drop operations using
the method.
Saves the grid contents to a file.
Name of the file to save, including the path.
File format to use.
Options to use when saving the file.
to use when saving the file.
Grids saved to CSV and other text files include data only (no formatting information is saved).
Grids saved to Excel files include data and formatting information. Images are not saved.
Grids can also be persisted to Xml format using the and methods.
Saves the grid contents to a file.
Name of the file to save, including the path.
File format to use.
Options to use when saving the file.
Saves the grid contents to a file.
Name of the file to save, including the path.
File format to use.
Loads the grid from a file.
Name of the file to load, including the path.
File format to use.
Options to use when loading the file.
to use when saving the file.
This method loads grid from a file previously saved with the method.
Formats supported include comma-delimited text files (CSV format), tab-delimited
text files, and Microsoft Excel files (.XLS).
When loading text files, rows and columns are added to the grid if needed to
accommodate the file contents. Text files contain only data and no formatting information.
When loading Excel files, the grid retrieves the first worksheet from the specified
workbook file. The method allows you to specify which worksheet should be loaded.
You can use the
method allows you to retrieve a list of the worksheets stored in an XLS file.
The grid can save and load data and formatting information from XLS files.
Grids can also be persisted to Xml format using the and methods.
Loads the grid from a file.
Name of the file to load, including the path.
File format to use.
Options to use when loading the file.
Loads the grid from a file.
Name of the file to load, including the path.
File format to use.
Saves the grid contents to a Microsoft Excel (.XLS) file.
Name of the file to save, including the path.
Name of the sheet to add to the Excel workbook.
Options to use when saving the file.
to use when saving the file.
If the specified file exists, the control will add or replace a single worksheet in it.
Existing sheets will be preserved if possible.
The worksheet to add or replace is identified by the parameter.
If the specified file is in use by another application (usually Excel), the method will fail.
This method does not require Microsoft Excel to be installed on the machine.
Saves the grid contents to a Microsoft Excel (.XLS) file.
Name of the file to save, including the path.
Name of the sheet to add to the Excel workbook.
Options to use when saving the file.
If the specified file exists, the control will add or replace a single worksheet in it.
Existing sheets will be preserved if possible.
The worksheet to add or replace is identified by the parameter.
If the specified file is in use by another application (usually Excel), the method will fail.
This method does not require Microsoft Excel to be installed on the machine.
Saves the grid contents to a Microsoft Excel (.XLS) file.
Name of the file to save, including the path.
Name of the sheet to add to the Excel workbook.
Saves the grid contents to a Microsoft Excel (.XLS) file.
Name of the file to save, including the path.
Saves the grid contents to a Microsoft Excel (.XLS) file.
Name of the file to save, including the path.
Loads the grid from a Microsoft Excel (.XLS) file.
Name of the file to load, including the path.
Name of the worksheet to load.
Options to use when loading the file.
Use the method to obtain a list of the worksheets
in an XLS file.
Loads the grid from a Microsoft Excel (.XLS) file.
Name of the file to load, including the path.
Name of the worksheet to load.
Use the method to obtain a list of the worksheets
in an XLS file.
Loads the grid from the first worksheet in a Microsoft Excel (.XLS) file.
Name of the file to load, including the path.
Options to use when loading the file.
Loads the grid from the first worksheet in a Microsoft Excel (.XLS) file.
Name of the file to load, including the path.
Gets a list with the names of the worksheets in a Microsoft Excel (.XLS) file.
Name of the Excel file, including the path.
An array containing the names of the worksheets defined in the file.
This method is used to obtain a list of sheet names that can later be used to load and
save specific sheets using the and methods.
The code below loads all sheets in an Excel workbook into a collection of grids in a
TabControl:
// clear tabControl
tabControl.TabPages.Clear();
// load sheet names
string fileName = "c:\book1.xls";
string[] sheets = _flexGrid.LoadExcelSheetNames(fileName);
// load each sheet
foreach (string sheetName in sheets)
{
// create a new grid for this sheet
C1FlexGrid flex = new C1FlexGrid();
flex.Dock = DockStyle.Fill;
// load sheet into new grid
flex.LoadExcel(fileName, sheetName);
// add grid to the tabControl
TabPage page = new TabPage();
page.Controls.Add(flex);
page.Text = sheetName;
tabControl.TabPages.Add(page);
}
Gets or sets whether the grid should display a new row template after the last data row.
If the user enters data into the new row template, a new row is automatically added to the grid.
This property works in bound mode (if the data source supports adding new rows) and also in
unbound mode.
Note that if this property is set to true, the Rows.Count property will return a value
that includes the new row template. If you set the Rows.Count property, the grid will set the
number of data rows and will automatically add the new row template. For example:
flex.AllowAddNew = true;
flex.Rows.Count = 10;
Console.WriteLine("Row count is {0}.", _flex.Rows.Count);
Row count is 11.
Gets or sets whether the grid should monitor the keyboard and handle the DEL key.
If this property is set to true, the user can delete rows by selecting them and then pressing
the DEL key.
This property works in bound mode (if the data source supports deleting rows) and in unbound mode.
Gets the collection of control glyphs (images used to show sorting, check boxes, etc).
The property returns a collection with an indexer
of type . This collection allows you to get or set the images used to
indicate column sorting, collapsed and expanded outline groups, check boxes, cursors,
error information, etc.
Note: Setting a glyph to null restores the default (built-in) image. If you want to make a glyph
invisible, set it to a small blank image instead.
For example, the code below causes the grid to use custom images to display the column sorting order
(instead of the built-in hollow triangles):
flex.Glyphs[GlyphEnum.Ascending] = imgAscending;
flex.Glyphs[GlyphEnum.Descending] = imgDescending;
Gets or sets whether the grid should handle the clipboard keys and automatically
perform cut, copy, paste, and delete operations.
Setting this property to true causes the grid to monitor the keyboard for the
following clipboard keys:
Copy: CTRL-INS, CTRL-C
Cut: CTRL-X, SHIFT-DEL
Paste: CTRL-V, SHIFT-INS
Delete: DEL
Cut, paste, and delete actions are performed only if the
property is set to true.
If you want to handle only a subset of the supported keys, add a handler to the
event and set the Handled parameter to true to disable some of the keys.
Automatic clipboard operations only affect the grid data. Styles and images are
not copied, pasted, or deleted.
Values copied to the clipboard are affected by the setting of the
property.
Gets or sets a custom comparer object used by the grid to perform grouping,
merging, and searching operations.
The grid has a default implementation that is used to compare
cells and determine if their contents are equivalent. This implementation is used when merging,
grouping, or searching for values (see the property and the
and methods).
The default implementation is case-sensitive and takes leading and trailing blanks into account.
If you want to merge cells using a case-insensitive comparison or trimming blanks,
write a custom class that implements the interface and assign an
instance of it to the grid's property.
Setting this property to null (Nothing in Visual Basic) restores the default behavior.
The code below replaces the built-in comparer with a .
This causes the method to group items that differ only in case into the
same groups:
// use case-insensitive comparer
flex.CustomComparer = new CaseInsensitiveComparer();
// add groups ignoring case
flex.Subtotal(AggregateEnum.Sum, 0, groupOn, totalOn);
// restore default (case-sensitive) comparer
flex.CustomComparer = null;
Gets or sets an flags that affect the grid's editing behavior.
The default value for this property is , which enables
all editing options. See the enumeration for a list of
options available.
Gets a value that determines if a cell contains the grid cursor.
Row index.
Column index.
True if the cell contains the cursor, false otherwise.
Gets a value that determines if a cell belongs to a fixed row or column.
Row index.
Column index.
True if the cell is fixed, false otherwise.
Gets a value that determines if a cell is selected.
Row index.
Column index.
True if the cell is selected, false otherwise.
Gets a value that determines if a pair of cell coordinates are valid.
Row index.
Column index.
True if the cell coordinates are valid, false otherwise.
Gets a value that determines if a cell is part of the selection and should be highlighted.
Row index.
Column index.
True if the cell should be highlighted, false otherwise.
Gets a value that determines whether the cell contents are displayed as a checkbox.
Row index.
Column index.
True if the cell contents should be displayed as a checkbox, false otherwise.
Boolean values are displayed as check boxes unless one of the following conditions is true:
1) The cell has an associated . In this case the values specified
in the DataMap are displayed instead of check boxes.
2) The cell has a multi-part string (such as "yes;no"). In this case
the Format is used instead of check boxes.
3) The cell belongs to a subtotal row and does not contain a Boolean value.
Specifies whether text rendering should be compatible with previous releases of WinForms.
This property determines whether the control should render text using the
class (compatible with previous versions), or the new class
(available in .NET 2.0 and later).
The class supports complex scripts and Uniscribe APIs, making
it better suited for some international applications.
However, the class seems to render about 25% slower than the
traditional method.
You may want to try both modes and select the one that matches the appearance of other
controls and forms in your application.
Gets a object that provides easy access to properties of the currently
active ComboBox editor.
The object can be used to get and set properties on the currently
active ComboBox editor without casting the property.
If no editor is active, or if the editor is not a , these properties
return null or -1, and cannot be set.
The code below shows two equivalent ways of accessing the selected index of the currently active ComboBox editor:
// with the ComboBoxEditor property:
Console.WriteLine("The current combo index is {0}",
_flex.ComboBoxEditor.SelectedIndex);
// without the ComboBoxEditor property:
ComboBox cb = _flex.Editor as ComboBox;
int index = (cb != null) ? cb.SelectedIndex : -1;
Console.WriteLine("The current combo index is {0}",
index);
Gets or sets a value that specifies the grid scrolling behavior.
Gets or sets flag that specify entering edit mode of cell after exiting from previous cell with arrow keys or tab key.
Gets or sets an C1SuperErrorProvider object used to indicate error state of the control.
Saves the grid contents to an Xml document.
Name of the file to save, including the path.
The grid serializes all its contents into the Xml document, including the
data stored in the cells, row and column properties, styles, images, etc.
Objects of custom types stored in the grid are also serialized as long as
they have an associated that provides conversions to
and from string.
The method has several overloads that allow you to
save several grids into a single Xml document, along with other information stored
in the Xml document.
The code below saves a grid into an Xml file:
// save a grid into am Xml file
flex.WriteXml(fileName);
The code below saves two grids into an Xml file, then reads them back in reverse order:
// prepare XmlTextWriter
XmlTextWriter w = new XmlTextWriter(fileName, new UTF8Encoding(false));
w.Formatting = Formatting.Indented;
w.WriteStartDocument();
w.WriteStartElement("Grids");
// save first grid
w.WriteStartElement(c1FlexGrid1.Name);
c1FlexGrid1.WriteXml(w);
w.WriteEndElement();
// save second grid
w.WriteStartElement(c1FlexGrid2.Name);
c1FlexGrid2.WriteXml(w);
w.WriteEndElement();
// close document
w.WriteEndElement();
w.Close();
// load document from file
XmlDocument doc = new XmlDocument();
doc.Load(fileName);
XmlNode n = doc.SelectSingleNode("Grids");
// load grids in reverse order
c1FlexGrid2.ReadXml(n.ChildNodes[0]);
c1FlexGrid1.ReadXml(n.ChildNodes[1]);
Saves the grid contents to an Xml document.
The where the document is saved.
Saves the grid contents to an Xml document.
The where the document is saved.
Saves the grid contents to an Xml document.
The where the document is saved.
Loads the grid from an Xml document.
Name of the file to load, including the path.
Loads the grid from an Xml document.
object to use for loading the grid.
Loads the grid from an Xml document.
object to use for loading the grid.
Loads the grid from an Xml document.
object to use for loading the grid.
Loads the grid from an Xml document.
object to use for loading the grid.
Loads the grid from an Xml document.
object to use for loading the grid.
Raises the event.
Object raising the event.
A that contains event data.
Gets a rectangle that defines the scrollable portion of the control.
The value returned corresponds to the control's client area minus any fixed
and frozen rows and columns.
Builds a rectangle that defines the scrollable portion of the control for a given pair of scroll offsets.
Horizontal scroll offset.
Vertical scroll offset.
A that defines the scrollable portion of the control.
This method is for internal use. It allows derived classes to customize the control scrolling behavior.
Raises the event.
An that contains the event data.
Raises the event.
An that contains the event data.
Raises the event.
An that contains the event data.
Raises the event.
A that contains the event data.
Paints the control background.
A that contains information about the control to paint.
Called when the control receives a WM_THEMECHANGED message.
The WM_THEMECHANGED message is broadcast to every window following a
theme change event. Examples of theme change events are the activation of a
theme, the deactivation of a theme, or a transition from one theme to another.
Gets or sets the background color for the control.
This is the color used to paint the background of the scrollable cells, also defined by the
cell style.
Gets or sets the foreground color for the control.
This is the color used to paint the text in scrollable cells, also defined by the
cell style.
Raises the event.
An that contains the event data.
Raises the event.
An that contains the event data.
Raises the event.
An that contains the event data.
Calculates the new position of a scrollbar in response to a user command.
Scroll command (SB_LINEUP, etc).
True for the vertical scrollbar, false for the horizontal scrollbar.
Current scrollbar position.
Scrollbar thumb position.
The new position for the scrollbar.
Derived classes may override this method to customize the scrolling behavior.
Raises the event.
A that contains the event data.
Raises the event.
that contains the event data.
Fires when a row is losing focus and needs to be validated.
This event is analogous to the event.
Use this event to perform validation on all the values of a row.
If the row does not pass validation, set the property to true.
Canceling this event prevents the event from occurring,
and also prevents the user from leaving the invalid row.
Raises the event.
A that contains the event data.
Fires after a row lost focus and has been validated.
This event is analogous to the event.
Use this event to perform post-processing on a row of values.
Raises the event.
A that contains the event data.
Moves or extends the current selection.
value that specifies the type of cursor movement.
Whether to extend the current selection.
This method is for internal use. It allows inherited classes to customize the grid appearance.
Moves or extends the selection from a given cell.
value that specifies the type of cursor movement.
Whether to extend the current selection.
Row index for the initial selection.
Column index for the initial selection.
This method is for internal use. It allows inherited classes to customize the grid appearance.
Gets a value that indicates what types of child nodes a row has.
This method is for internal use. It allows inherited classes to customize outline trees.
Row index.
Column index.
Outline level.
Zero if the row has no children, 1 if it has regular data rows only,
2 if it has child nodes, and 3 if it has data and child nodes.
Gets a rectangle representing the coordinates of a cell, row, or column.
This method is for internal use. It allows inherited classes to customize the way cell geometry
is calculated.
Row index (or -1 to get column bounds).
Column index (or -1 to get row bounds).
Whether the rectangle should be horizontally clipped to the grid's client area.
Whether the rectangle should be vertically clipped to the grid's client area.
A containing the display area for the row, column, or cell,
in client coordinates and accounting for scroll position.
Gets a rectangle representing the coordinates of a cell, row, or column.
This method is for internal use. It allows inherited classes to customize the way cell geometry
is calculated.
Row index (or -1 to get column bounds).
Column index (or -1 to get row bounds).
A containing the display area for the row, column, or cell,
in client coordinates and accounting for scroll position.
Gets a rectangle representing the coordinates of a cell editor.
This method is for internal use. It allows inherited classes to customize the way cell geometry
is calculated.
Row index.
Column index.
Rectangle used to position the cell editor.
Draws a grid row.
A that contains a
object where the row will be drawn.
Index of the row to draw.
This method is for internal use. It allows inherited classes to customize the grid appearance.
Draws a grid cell.
A that contains a
object where the cell will be drawn.
Index of the cell's row.
Index of the cell's column.
The index of the last column painted (may be greater than
if columns are merged).
This method is for internal use. It allows inherited classes to customize the grid appearance.
Gets the state for a Windows Xp theme while the mouse moves over a cell.
This method is for internal use. It allows inherited classes to customize the
hot-tracking behavior.
Row under the mouse.
Column under the mouse.
An integer representing the item state (2 for hot-tracking, 1 for normal).
Gets a cell glyph to show in a cell.
This method is for internal use. It allows inherited classes to customize the display of the sorting glyphs.
Row index.
Column index.
Cell rectangle
Glyph to display above the cell content.
Glyphs to display on the left of the cell.
Glyphs to display on the right of the cell.
True if any glyphs were assigned to the cell, false otherwise.
Gets the state of the checkbox in a grid cell.
Row index.
Column index.
One of the values in the enumeration.
By default, the grid displays values in Boolean columns as check boxes (the column's
data type determined by the property). If you don't want Boolean
values displayed as check boxes, set the column's property to a
string containing the values that should be displayed for True and False values, separated by
a semi-colon. For example:
flex.Cols["CheckBoxes"].DataType = typeof(bool);
flex.Cols["yesNo"].DataType = typeof(bool);
flex.Cols["yesNo"].Format := "Yes;No";
In unbound mode, you can use the and
methods to add check boxes to any cells. The check boxes will be displayed along with any text in
the cell, and you can set their position using the column's property.
There are two types of check boxes: Boolean and tri-state. Boolean check boxes toggle between
the and states. Tri-state check
boxes cycle through the settings , ,
and .
For example, the code below creates a Boolean checkbox in cell (3,3) and a tri-state checkbox
in cell (4,3):
flex.SetCellCheck(3, 3, CheckEnum.Unchecked) // Boolean;
flex.SetCellCheck(4, 3, CheckEnum.TSUnchecked) // tri-state;
Sets the state of the checkbox in a grid cell.
Row index.
Column index.
value to assign to the cell.
For details and examples, see the method.
Applies a value to a cell or cell range.
This method is for internal use. It allows inherited classes to customize the way checkbox
data is applied to the cells when cells are edited.
Row index.
Column index.
Value to apply to the cell.
Adjusts the width of a column range to fit the data in a cell range.
Top row in the range.
Left column in the range.
Bottom row in the range.
Right column in the range.
Amount of extra space, in pixels, to add to the column widths.
Flags that control auto-sizing options.
By default, the method measures every cell in each column,
taking into account the cell contents and style.
If the grid has a large number of rows, you can improve performance by using the
and parameters to specify a row range.
You can include only a few hundred rows in the process, and add some extra spacing for safety.
Adjusts the width of all columns to fit the data.
Adjusts the width of columns in a range to fit the data.
Left column in the range.
Right column in the range.
Amount of extra space, in pixels, to add to the column widths.
Adjusts the width of all columns fit the data.
Amount of extra space, in pixels, to add to the column widths.
Adjusts the width of a column to fit the data.
Column index.
This method measures every cell in the column, taking into account the cell contents and style.
If the grid has a large number of rows, consider using the
method instead, because it allows you to specify a smaller set of rows and columns to measure.
Adjusts the width of a column to fit the data.
Column index.
Amount of extra space, in pixels, to add to the column widths.
This method measures every cell in the column, taking into account the cell contents and style.
If the grid has a large number of rows, consider using the
method instead, because it allows you to specify a smaller set of rows and columns to measure.
Adjusts the height of a row range to fit the data in a cell range.
Top row in the range.
Left column in the range.
Bottom row in the range.
Right column in the range.
Amount of extra space, in pixels, to add to the column widths.
Flags that control auto-sizing options.
Adjusts the height of all rows to fit the data.
Adjusts the height of a row to fit the data.
Row index.
Automatically size grid columns to fit the largest entry.
object used to measure the cell contents.
Index of the first row to be measured.
Index of the first column to be measured.
Index of the last row to be measured.
Index of the first column to be measured.
Extra space, in twips, to add to the largest entry.
value that specifies auto-sizing behavior.
This method is for internal use. It allows inherited classes to customize the grid appearance.
Automatically size grid columns to fit the largest entry.
object used to measure the cell contents.
Index of the first row to be measured.
Index of the first column to be measured.
Index of the last row to be measured.
Index of the first column to be measured.
Extra space, in twips, to add to the largest entry.
value that specifies auto-sizing behavior.
This method is for internal use. It allows inherited classes to customize the grid appearance.
Gets a reference to the column that defines the current sort applied to the grid.
The grid may be sorted by a call to the method, by a user clicking
a column header, or as a result of sorting applied directly to the object that is being
used as the grid's .
To determine the current sort direction, use the sorted column's
property.
If the grid is not currently sorted, this property returns null.
Gets or sets whether the control should use Xp themes for displaying row or column headers.
This property only has an effect if the application is themed. To enable themes for
an application, you can either call the Application.EnableVisualStyles method or use
a manifest file. Please refer to MSDN for details.
Setting the property to BorderStyleEnum.XpThemes
automatically sets this property to ShowThemedHeadersEnum.Both.
Raises the event.
An that contains the event data.
Raises the event.
An that contains the event data.
Raises the event.
An that contains the event data.
Raises the event.
An that contains the event data.
Determines whether the specified key is a regular input key or a special
key that requires preprocessing.
One of the values.
True if the specified key is a regular input key, False otherwise.
Determines if a character is an input character that the control recognizes.
The character to test.
True if the character should be sent directly to the control and not preprocessed, False otherwise.
Raises the event.
A that contains the event data.
Raises the event.
A that contains the event data.
Raises the event.
An that contains the event data.
Raises the event.
A that contains the event data.
Raises the event.
A that contains the event data.
Raises the event.
A that contains the event data.
Raises the event.
An that contains the event data.
Called when the grid contents scroll.
value that specifies the scroll direction.
This method is for internal use. It allows inherited classes to customize the grid scrolling behavior.
Called when the grid contents scroll vertically, to update the value of the scroll tip.
New value for the vertical scroll bar.
This method processes the new scroll position and calls .
Raises the event.
A that contains event data.
Raises the event.
A that contains event data.
Raises the event.
A that contains event data.
Gets or sets a value that determines the overall appearance of the control.
This property allows you to quickly customize the appearance of the grid so
it matches the appearance of your application.
The settings available include System, various Microsoft Office color
schemes, and Custom, which relies on the control's standard styles and
appearance properties.
Gets a value that determines whether the
property is set explicitly and should be persisted.
True if the property was explicitly set by the user.
Resets the value of the ambient property.
Method invoked when the property changes.
Gets or sets a used to customize the look and
feel of the control.
Gets the current .
Gets or sets a string that is displayed over the new row template
when the property is set to true.
Gets or sets what parts of the grid are copied to the clipboard when the
property is set to true.
Copies the current selection to the clipboard.
Cuts the content of the current selection to the clipboard.
This command copies the current selection to the clipboard, then deletes
the editable content within the selection.
Pastes the content of the clipboard onto the current selection.
Gets or sets whether the user is allowed to filter the data.
When this property is set to true, the grid displays filter icons
on the column headers. Users may click the icons to define filters to be
applied to the data.
When a filter is applied, the grid hides rows that don't match the
filter by setting their property to false. The
filter is not applied to the data source.
You may specify the type of filter to use for each individual column
by setting the columns property.
You may also create custom filters by creating classes the implement
the interface and assigning instances of that
class to the column's property.
Gets or sets a value that determines whether the filter should ignore diacritics
(accents) when comparing values.
By default, the filter compares values as they appear in the data source.
For example, if you are looking for values that contain the string "fac", you
will find "factory" but not "façade".
If you set this property to true, the filter will remove any diacritics
before performing the comparisons. In this case, looking for the string "fac"
will return both "factory" and "façade".
This property is especially useful in applications localized for languages
that contain many accents, such as French, Spanish, Portuguese, etc.
Gets or sets an XML string containing the current filter state.
Applies all column filters to the data on the grid.
Edits the filter associated with a given column.
Index of the column whose filter should be edited.
Edits the filter associated with a given column.
whose filter should be edited.
Clears the filter associated with a given column.
Index of the column whose filter should be cleared.
Clears the filter associated with a given column.
whose filter should be cleared.
Clears all column filters.
Applies search to the data on the grid.
Words which will be searched.
Defines will search results be highlighted or not.
Defines will search results be filtered or not.
Defines will perform search through only visible columns or not.
Applies search to the data on the grid.
Words which will be searched.
Defines will search results be highlighted or not.
Defines will search results be filtered or not.
Applies search to the data on the grid.
Words which will be searched.
Gets or sets the language to use when localizing the column filters.
Specifies how grid columns should be sorted.
This enumeration contains flags that can be combined to customize the sorting process.
For example, the code below sorts two grid columns ignoring case.
// C#
SortFlags order = SortFlags.Ascending | SortFlags.IgnoreCase;
_flex.Sort(order, col1, col2);
' VB
Dim order As SortFlags = SortFlags.Ascending Or SortFlags.IgnoreCase
_flex.Sort(order, col1, col2)
Do not sort. This setting is useful for skipping certain columns when sorting column ranges.
Sort in ascending order.
Sort in descending order.
Sort using the string representation of the data. In this mode, "100" appears before "2".
Ignore case when sorting strings.
Use the flags stored in the property of individual objects.
Specifies which elements of the grid should be cleared by the method.
This enumeration contains flags that can be combined to customize the sorting process.
Clear cell content, including data, images, and check boxes if any.
Clear custom styles assigned to cells.
Clear user data associated with cells.
All of the above.
Specifies the type of checkbox to draw in a cell.
There are two types of check boxes: regular and tri-state.
Regular check boxes are used to display simple Boolean values.
They cycle through settings Checked and Unchecked when clicked with the mouse.
Tri-state check boxes are used to display values that may be true, false, or
indeterminate (grayed). They cycle through settings TSChecked, TSGrayed, and
TSUnchecked when clicked with the mouse.
Visually, Checked and Unchecked look the same as TSChecked and TSUnchecked.
No check box.
Check box with a check mark in it.
Empty check box.
Check box in undefined state.
Tri-state check box with a check mark in it.
Tri-state empty check box.
Tri-state check box in undefined state.
Specifies the type of aggregate function to calculate with the and
methods.
No aggregate. This setting is used with the method to create an
outline tree without any numerical aggregates.
Clear existing aggregates. This setting is used with the method
to clear any existing subtotals, usually before calculating new subtotals.
Returns the sum of all values in the range.
Percent of grand total. This setting is used with the method to
calculate the percentage of the grand total represented by each sub group. (This setting can't
be used with the method).
Returns the count of non-empty cells in a range.
Returns the average value of the non-empty cells in a range.
Returns the maximum value in a range.
Returns the minimum value in a range.
Returns the sample standard deviation of the values in a range (uses the formula based on n-1).
Returns the sample variance of the values in a range (uses the formula based on n-1).
Returns the population standard deviation of the values in a range (uses the formula based on n).
Returns the population variance of the values in a range (uses the formula based on n).
Specifies options to use when calculating aggregates with the method.
Default setting. Include all rows and use numerical values only.
Exclude node rows from aggregate. This option is useful when the grid contains subtotal rows,
which are marked as nodes and contain values that are subtotals and should thus be excluded
from aggregates.
Calculate aggregates for dates instead of numerical values. Only a few aggregate functions
are meaningful for dates: count, maximum, and minimum.
Calculate aggregates for Boolean values. This flag causes the value True to be interpreted as one,
and False as zero. This option is useful for counting the number of checked check boxes in a range.
Exclude hidden rows and columns from the aggregate.
Exclude collapsed rows from the aggregate.
Exclude hidden rows from the aggregate.
Specifies whether subtotals rows created with the method should be
inserted above or below the data they refer to.
Subtotal rows are inserted above the data (tree-style).
Subtotal rows are inserted below the data (spreadsheet-style).
Specifies the type of change that occurred when the controls fires the
event.
No action.
The number of grid rows or columns has changed.
The number of fixed grid rows or columns has changed.
A style definition has changed.
A style has been applied to a range.
The grid has been invalidated and will be repainted.
The value in a cell has changed.
A range has been invalidated and will be repainted.
The grid will be repainted.
A tree node is about to be collapsed or expanded.
A tree node has just been collapsed or expanded.
A tree node will be scrolled into view.
A tree node will be selected.
A row has been moved into a new position.
A row has been added to the grid.
A row has been removed from the grid.
A row has been selected or de-selected.
A column has been moved into a new position.
A column has been added to the grid.
A column has been removed from the grid.
A column has been selected or de-selected.
The selection is about to change.
The selection has just changed.
Represents the method that will handle the event.
Provides data for the event handler.
The type of action that caused the event to fire.
Range of cells affected by the event.
Range of cells affected by the event.
Range of cells affected by the event.
Range of cells affected by the event.
Represents cell ranges, allowing the caller to set properties for multiple cells
with a single statement.
The structure does not have a public constructor. To create a
object, use the method.
Note that is a structure, not a class. This means the object is used as a value,
not as a reference. If you pass a to a method and change the object within that method,
the original value is not modified.
Ranges are defined by two rows and two columns (, , , and
). These values do not have to be in order ( may be smaller or greater than
). To obtain the values in order, use the method or the ,
, , and properties.
Gets or sets the range's first row index.
Gets or sets the range's first column index.
Gets or sets the range's last row index.
Gets or sets the range's last column index.
Gets a value that indicates if the range contains a single cell.
Gets a value that indicates if the range contains valid row and column indices.
This property returns true if the range coordinates are valid. The range is valid
if both r1 and r2 are between 0 Rows.Count-1, both c1 and c2 are between 0 and
Cols.Count-1.
Determines whether the range contains a given row.
Index of the row to check.
True if the range contains the row, False otherwise.
Determines whether the range contains a given column.
Index of the column to check.
True if the range contains the column, False otherwise.
Determines whether the range contains a given cell.
Index of the row to check.
Index of the column to check.
True if the range contains the cell, False otherwise.
Gets the index of the top row in the range.
Gets the index of the bottom row in the range.
Gets the index of the left column in the range.
Gets the index of the right column in the range.
Normalizes the range so that is the ,
is the ,
is the ,
and is the .
Gets or sets the data stored in the range.
When getting, this property returns the value in the first cell of
the range (r1, c1). When setting, it stores the given value in every
cell within the range.
Gets the value in cell (, ), formatted as a string.
This property is similar to the property, except Clip
returns a tab-delimited string containing data in the entire range, and DataDisplay
returns the contents of the first cell only (r1, c1).
Gets or sets the style used to display every cell in the range.
Getting or setting the range style ensures that every cell in the range has
the same style. If the range does not contain any cells with custom styles,
this property returns null.
The code below creates a structure and uses it to
apply a custom style to the entire range.
// create a style
CellStyle cs = _flex.Styles.Add("red");
cs.BackColor = Color.Red;
// create a cell range and assign it a style
CellRange rg = _flex.GetCellRange(1, 1, 5, 5);
rg.Style = cs;
Gets or sets the style used to display every cell in the range, creating a new style if necessary.
This property never returns null. If the range does not have a style assigned to it, a new style
will be created automatically.
The code below creates a structure and uses it to apply a custom style to
the entire range.
// create a cell range
CellRange rg = _flex.GetCellRange(1, 1, 5, 5);
// make sure range is red
rg.StyleNew.BackColor = Color.Red;
Gets the style used to render cell (, ).
This property never returns null. It will return the custom style assigned to the
first cell in the range, to the cell's row, column, or a built-in style.
Gets or sets the state of the checkbox in the range.
When getting, this property returns the checkbox value that corresponds to cell
(, ). When setting, it applies the new value to all
cells in the range.
Gets or sets the assigned to cells in the range.
When getting, this property returns the assigned to cell
(, ). When setting, it applies the new value to all
cells in the range.
Gets or sets arbitrary used data assigned to cells in the range.
When getting, this property returns the user data assigned to cell
(, ). When setting, it applies the new value to all
cells in the range.
Gets or sets a string containing the values of all cells in the range.
The cell values are delimited by characters specified by the
property.
By default, columns are separated by tabs (\t or vbTab) and rows by line breaks (\n or vbCr).
Clears selected elements from the range.
value that specifies which elements
should be cleared.
Gets a string representation for this object.
A string representation for this object.
Collection of objects.
Initializes a new instance of a .
Grid that owns the collection.
Gets or sets the object at a specified index.
Gets the number of objects in the collection.
Adds a new object to the collection.
Top row in the range.
Left column in the range.
Bottom row in the range.
Right column in the range.
The index of the object in the collection.
Adds a new object to the collection.
Object to add to the collection.
The index of the object in the collection.
Adds a new object to the collection, optionally
removing other overlapping ranges from the collection.
Top row in the range.
Left column in the range.
Bottom row in the range.
Right column in the range.
Whether to remove overlapping
ranges from the collection before adding the new range.
The index of the object in the collection.
Adds a new object to the collection, optionally
removing other overlapping ranges from the collection.
Object to add to the collection.
Whether to remove overlapping
ranges from the collection before adding the new range.
The index of the object in the collection.
Removes all objects from the collection.
Determines whether a object is a member of the collection.
Object to locate in the collection.
True if the object is a member of the collection, false otherwise.
Gets the index of a object in the collection.
Object to locate in the collection.
The index of the object in the collection, or -1 if the object is not a member of the collection.
Gets the index of the first object in the collection that contains the specified row and column.
Index of the row contained in the range.
Index of the column contained in the range.
The index of the object in the collection, or -1 if no range could be found containing the specified row and column.
Inserts a object in the collection at a specified index.
Removes a object from the collection.
Object to remove from the collection.
Removed the object at a specified index from the collection.
Index of the object to remove from the collection.
Represents a filter based on one or two logical conditions.
Initializes a new instance of a .
Gets the first filter condition.
Gets the second filter condition.
Gets or sets whether the filter conditions should be combined
with an 'And' or with an 'Or' operator.
Creates a clone of this .
A clone of this .
Gets or sets a value that determines whether the filter is active.
Resets the filter making it inactive.
Applies the filter to a value.
Value to be filtered.
True if the satisfies the filter;
False otherwise.
Gets the editor used to modify the filter at run time.
A that is used to modify the filter at run time.
Represents operators used in filter conditions.
Disables the operator.
Return true if the value equals the operator parameter.
Return true if the value does not equal the operator parameter.
Return true if the value is greater than the operator parameter.
Return true if the value is less than the operator parameter.
Return true if the value is greater than or equal to the operator parameter.
Return true if the value is less than or equal to the operator parameter.
Return true if the string representation of the value contains the operator parameter.
Return true if the string representation of the value does not contain the operator parameter.
Return true if the string representation of the value begins with the operator parameter.
Return true if the string representation of the value ends with the operator parameter.
Represents a condition within a .
Each contains up to two conditions that
can be combined with 'And' or 'Or' operators.
Gets a value that indicates whether the condition is active.
Gets or sets the operator used by this condition.
Gets or sets the parameter used by this condition.
Clears this condition by setting the to 'None'
and the to null.
Applies the condition to a given value.
Value to test.
True if the value satisfies the condition, false otherwise.
Specifies the behavior of the control as an OLE drag-drop target.
The control can't be used as a drop target.
The control fires drag-drop events that can be handled to provide drop target functionality.
The control automatically handles dropping of text or filename data.
Specifies the behavior of the control as an OLE drag-drop source.
The control does not provide any drag support. The caller can still initiate drag-drop operations
using the method.
The control provides automatic dragging of data. If the mouse hovers near the edges of the selected range,
the cursor will change and allow the user to move or copy data (pressing the CTRL key to copy).
Same as Automatic, except the data is always copied (never moved).
Same as Automatic, except the data is always moved (never copied).
Represents the method that will handle the event.
Object that fired the event.
object that contains the event data.
Provides data for the event.
Gets which mouse button was pressed.
Gets the number of times the mouse button was pressed and released.
Gets the x-coordinate of a mouse click.
Gets the y-coordinate of a mouse click.
Gets a signed count of the number of detents the mouse wheel has rotated. A detent is one notch of the mouse wheel.
Gets or sets a value indicating whether the event should be canceled.
Initializes a new instance of the BeforeMouseDownEventArgs class.
with mouse event information.
Initializes a new instance of the BeforeMouseDownEventArgs class.
Control that will fire the event.
value that indicates which button was pressed.
Number of times the button was pressed and released.
Represents the method that will handle the , , and events.
Object that fired the event.
object that contains the event data.
Provides data for the , ,
, and events.
Gets the original index of the row that was dragged by the user.
Gets the original index of the column that was dragged by the user.
Gets the new index of the column or row that was dragged by the user.
Gets or sets a value indicating whether the drag operation should be canceled.
Initializes a new instance of the DragRowColEventArgs class.
The original index of the row that was dragged by the user.
The original index of the column that was dragged by the user.
The new index of the column or row.
Represents the method that will handle the and
events.
Object that fired the event.
object that contains the event data.
Provides data for the and events.
Gets the column that is being sorted.
Gets or sets a value that determines the sorting order.
Gets or sets a value indicating whether the drag operation should be canceled.
Setting this parameter to true cancels the built-in sort operation and leaves the sorting glyph unchanged.
Gets or sets a value indicating whether the drag operation has been handled by the event handler.
Setting this parameter to true cancels the built-in sort but updates the sorting glyph as if the
sort had been performed. This is useful when the event handler performs custom sorting.
Initializes a new instance of the SortColEventArgs class.
The column that is being sorted.
value that determines the sorting order.
Represents the method that will handle the ,
, ,
, ,
, ,
, ,
, ,
, and events.
Object that fired the event.
object that contains the event data.
Provides data for the , ,
, ,
, ,
, ,
, ,
, , and
events.
Gets the index of the row that caused the event.
This value may be set to -1 if the event was caused by a column.
Gets the index of the column that caused the event.
This value may be set to -1 if the event was caused by a row.
Gets or sets a value indicating whether the operation should be canceled.
Initializes a new instance of the RowColEventArgs class.
Index of the row that caused the event.
Index of the column that caused the event.
Represents the method that will handle the ,
, ,
, , and
events.
Object that fired the event.
object that contains the event data.
Provides data for the , ,
, ,
, and events.
Gets the range selected before the event.
Gets the range that will be selected after the event.
Gets or sets a value indicating whether the new selection should be canceled.
Initializes a new instance of the RangeEventArgs class.
The range selected before the event.
The range that will be selected after the event.
Represents the method that will handle the event.
Object that fired the event.
object that contains the event data.
Provides data for the event.
Gets or sets the text to be displayed in the tooltip.
Initializes a new instance of the ToolTipEventArgs class.
Index of the row that caused the event.
Index of the column that caused the event.
Text to display in the ToolTip
Represents the method that will handle the and
events.
Provides data for the and events.
Gets the row index of the cell being edited when the key was pressed.
Gets the column index of the cell being edited when the key was pressed.
Gets the integer representation of the property.
Gets the key code for the event, which will be one of the values.
Gets the key code for the key that was pressed, combined with modifier flags that indicate which
combination of CTRL, SHIFT, and ALT keys were pressed at the same time.
Gets the modifier flags, as defined in Keys. This indicates which combination of modifier keys
(CTRL, SHIFT, and ALT) were pressed.
Gets a value indicating whether the ALT key was pressed.
Gets a value indicating whether the CTRL key was pressed.
Gets a value indicating whether the SHIFT key was pressed.
Gets or sets a value indicating whether the event was handled and should be ignored by the control.
Initializes a new instance of the KeyEditEventArgs class.
The row index of the cell being edited when the key was pressed.
The column index of the cell being edited when the key was pressed.
A object containing the keyboard data.
Represents the method that will handle the event.
Provides data for the event.
Gets the row index of the cell being edited when the key was pressed.
Gets the column index of the cell being edited when the key was pressed.
Gets the character corresponding to the key pressed.
Gets or sets a value indicating whether the event was handled and should be ignored by the control.
Initializes a new instance of the KeyPressEditEventArgs class.
The row index of the cell being edited when the key was pressed.
The column index of the cell being edited when the key was pressed.
The character corresponding to the key pressed.
Represents the method that will handle the event.
Provides data for the event.
Gets the row index of the cell being edited.
Gets the column index of the cell being edited.
If the cell contains a checkbox, the new checkbox state about to be applied to the cell.
Gets or sets a value indicating whether the edit operation should be canceled.
If this parameter is set to true, the edits are considered invalid. The editor will remain open
and the current cell selected until the user provides a valid entry or cancels the edit operation
by pressing the ESC key.
Initializes a new instance of the ValidateEditEventArgs class.
The row index of the cell being edited.
The column index of the cell being edited.
The new checkbox state about to be applied to the cell, if any.
Represents the method that will handle the event.
Provides data for the event.
Gets the row index of the cell where the error was detected.
Gets the column index of the cell where the error was detected.
Gets the object that contains information about the error.
Gets or sets a value indicating whether the error situation has been handled by the control.
If this value is set to False, the grid will throw the exception.
Initializes a new instance of the GridErrorEventArgs class.
The row index of the cell where the error was detected.
The column index of the cell where the error was detected.
The object that contains information about the error.
Whether the error was handled internally and no exception should be thrown.
Represents the method that will handle the and
events.
Provides data for the and
events.
Gets the index of the row that may contain errors.
Gets the index of the column that may contain errors (or -1 if checking for row errors).
Gets or sets a message that describes the error.
Initializes a new instance of the class.
The row index when error information is needed for a cell or row.
The column index when error information is needed for a cell or row.
Represents the method that will handle the event.
Provides data for the event.
Initializes a new instance of the OwnerDrawCellEventArgs class.
The control that contains the cell being painted.
The object where the cell will be painted.
The row index of the cell being painted.
The column index of the cell being painted.
The that will be used to paint the cell.
The bounds of the cell being painted.
The text that will be displayed in the cell.
The image that will be displayed in the cell.
Gets the object used to draw the cell. Use this object to draw custom elements in the cell.
Get the row index of the cell being painted.
Get the column index of the cell being painted.
Sets or sets the object used to paint the cell.
This parameter is often used to provide dynamic formatting based on cell contents. For example,
if the cell contains a value outside a given range, the event handler may assign a new style to
this parameter.
Although it is legal to modify the members of the parameter in this
event, this is not recommended, since the change will affect other cells that may be using this style.
The code below uses the event to highlight cells that
indicate low stock levels.
// create style used to display low-stock items
CellStyle cs = _flex.Styles.Add("Critical");
cs.BackColor = Color.Red;
private void _flex_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
{
// ignore fixed cells
if (e.Row < _flex.Rows.Fixed || e.Col < _flex.Cols.Fixed)
return;
// apply custom style if reorder level is critical
if (_flex.Cols[e.Col].Name == "UnitsInStock")
{
// change the style by applying the "Critical" style to the Style parameter
// (do not change the e.Style.BackColor property directly since that would
// affect other cells that use this style)
if ((short)_flex[e.Row, "UnitsInStock"] < (short)_flex[e.Row, "ReorderLevel"])
e.Style = _flex.Styles["Critical"];
}
}
Get the rectangle where the cell will be painted (in client coordinates).
Gets or sets the text that will be displayed in the cell.
Changing this value is an easy way to modify the text displayed in a cell without any custom drawing code.
Gets or sets the image that will be displayed in the cell.
Changing this value is an easy way to modify the image displayed in a cell without any custom drawing code.
Gets a value that determines if the event was fired only to measure the cell.
This occurs while auto-sizing rows and columns, since the event handler may change the
value displayed in the cell while handling this event.
Gets or sets whether the event has finished drawing the cell.
If this parameter is set to true, the grid assumes the call has been painted by the event handler. If it
is set to false, the grid will paint the cell when the event returns.
Note that calling the method automatically sets this parameter to true.
Causes the grid to paint parts of the cell (background, foreground, border, etc.)
that specifies the parts of the cell.
This method is typically called in handlers when the code
intends to draw some elements of the cell but not everything.
For example, the code may want to draw a custom border only. In this case, it could call
e.DrawCell(DrawCellFlags.Background | DrawCellFlags.Content) to draw the cell background and content,
and later draw the custom border.
Or the code could want to draw a custom marker in a cell (like a note indicator in Excel). In this case, it
should call e.DrawCell() to draw the entire cell, and later add the note marker (little red triangle
on the top right corner of the cell).
If the owner-draw code draws the entire cell (including the background), then there's no need to call
e.DrawCell at all.
Causes the grid to paint the whole cell.
Represents the method that will handle the and
events.
object that raised the event.
that contains the event data.
Provides data for the and
events.
Gets the row index for the cell that has an unbound value.
Gets the column index for the cell that has an unbound value.
Gets or sets the unbound value that should be displayed in the cell.
Initializes a new instance of the UnboundValueEventArgs class.
Row index for the cell that has an unbound value.
Column index for the cell that has an unbound value.
Unbound value that should be displayed in the cell.
Represents the method that will handle the and
events.
object that raised the event.
that contains the event data.
Provides data for the and events.
Gets the value that specifies the type of aggregate to calculate..
Outline level to assign to the new subtotal rows.
Gets the index of the first column in the range used to detect group breaks.
Gets the index of the last column in the range used to detect group breaks.
Gets the index of the column that contains values being aggregated.
Gets or sets the text to insert in the new subtotal row.
Gets the index of the new subtotal row.
Gets a value that determines whether the subtotal row is a new row or the
subtotal is being added to an existing subtotal row.
Gets the index of the top row in the group.
Gets the index of the bottom row in the group.
Gets or sets the calculated aggregate value for the group.
Gets or sets the to be applied to the new subotal row.
Whether to cancel the creation of the new subtotal row.
Initializes a new instance of a object.
value that specifies the type of aggregate to calculate.
Outline level to assign to the new subtotal rows. This parameter allows the creation of multi-level subtotals and affects the display of the outline tree.
First column in the range used to detect group breaks.
Last column in the range used to detect group breaks.
Column that contains values being aggregated.
Text to insert in the new subtotal row.
Index of the new subtotal row.
Whether the subtotal row is a new row or the subtotal is being added to an existing subtotal row.
Index of the top row in the group.
Index of the bottom row in the group.
Calculated aggregate value for the group.
to be applied to the new subotal row.
Represents the method that will handle the event.
object that raised the event.
that contains the event data.
Provides data for the event.
Gets or sets the value of the localized string.
Gets the name of the component being localized.
Parent of the component being localized.
Component being localized.
Initializes a new instance of a .
Value to be localized.
Name of the component being localized.
Parent of the component being localized.
Component being localized.
Specifies the type of filter to be used for a .
Filter column using a .
Filter column by values using a .
Filter column by conditions using a .
Filter column using a filter specified by the caller.
Do not provide a filter for this column.
Specifies a type of glyph (image) used by the grid to convey information about a row, column, or cell.
Indicates column sorted in ascending order (default is hollow triangle pointing up).
Indicates column sorted in descending order (default is hollow triangle pointing down).
Checkbox in checked state.
Checkbox in unchecked state.
Checkbox in gray (undefined) state.
Collapsed tree node (default is plus sign).
Expanded tree node (default is minus sign).
Indicates current record (default is black triangle pointing right).
Indicates row being added to data source (default is asterisk).
Indicates row or cell error (default is red exclamation sign).
Indicates that a column has a drop-down filter editor.
Indicates that a column has a filter currently active.
Represents a collection of glyphs (images) indexed by glyph type ( type).
The collection contains the images used by the grid to indicate column
sorting direction, collapsed and expanded outline groups, check boxes, cursors, error information, etc.
You can use the property get or set these images.
Gets or sets the glyph for a particular value.
Setting a glyph to null causes the grid to use the default image for the glyph. To suppress
a glyph, assign it a small transparent image.
Specifies where the grid should start searching for cells when using the
property.
No auto-searching.
Search from the first scrollable row.
Search from the current row.
Specifies the action to perform when the ENTER and TAB keys are pressed.
No special action (allow system to handle the key). For example, the TAB key is normally
used to cycle through the controls on a form.
Move to the next row.
Move to the next column. At the end of the row, wrap to the start of the next row.
Same as MoveAcross, but move the focus to the next control in the tab order when
the last cell in the grid is reached.
This setting applies only to the property;
when used with it behaves like MoveAcross.
Type of grid element at a specific point on the control.
The point is in the grid's empty area.
The point is on a grid cell. (The cell coordinates are stored in the
and properties).
The point is on a fixed row, over a column.
The point is near the right edge of a fixed cell, in the column resizing area.
The point is near the right edge of the last frozen column, in the column freezing area.
The point is on a fixed column, next to a row.
The point is near the bottom edge of a fixed cell, in the row resizing area.
The point is near the bottom edge of the last frozen row, in the row freezing area.
The point is on a check box.
The point is on an edit button (drop down, popup editors).
The point is on the outline bar (visible when the grid's property
has a that contains the flag).
The point is on the collapse/expand button on an outline tree (visible when the grid's
property contains the flag).
The point is on the filter icon on a column header cell.
Contains information, such as the row and column indexes, about a specific coordinate pair
in the control.
Use the method to obtain a value.
Get the index of the row at the point being tested (if the point does not correspond to a cell, it returns -1).
Get the index of the column at the point being tested (if the point does not correspond to a cell, it returns -1).
The point on the control surface, in pixels.
The X coordinate of a point on the control surface, in pixels.
The Y coordinate of a point on the control surface, in pixels.
Gets a that describes the type of element described by a .
This property allows you to determine whether the point corresponds to a grid cell or
to special elements such as row and column headers, resizing areas, and so on.
Specifies a node with respect to another given node.
This enumeration is used with the method.
The node's top-level parent.
The node's immediate parent.
The node's first child.
The node's last child.
The node's first sibling (node with same level and same parent).
The node's last sibling.
The node's next sibling.
The node's previous sibling.
The node's first visible sibling.
The node's last visible sibling.
The node's next visible sibling.
The node's previous visible sibling.
The node's first visible child.
Specifies the destination of nodes when they are moved with the method.
Move the node one level in, deeper into the outline.
Move the node one level out, towards the root.
Move the node to the position before its previous sibling.
Move the node to the position after its next sibling.
Move the node to the position before its first sibling.
Move the node to the position after its last sibling.
Make the node a child of the specified node.
The class encapsulates properties and methods used for manipulating node rows
(collapsing, expanding, moving, and sorting them).
You can create node rows using the method or by setting the
property to true.
Gets or sets the outline level for this node.
Higher levels mean deeper nesting. Set the level to zero to create root nodes,
or set the level to negative values to create nodes that do not appear on the outline tree.
Gets or sets whether this node is collapsed.
Gets or sets whether this node is expanded.
Gets the number of child nodes under this node.
Only immediate children are included in the count. Grand-children are not included.
Gets or sets the image on this node row at the column that contains the outline tree.
Gets or sets the associated with this node row.
Gets or sets the data on this node row at the column that contains the outline tree.
Gets or sets the checkbox value associated with this node.
Returns a reference to the object that corresponds to this node.
Returns a CellRange object containing this row and all its child rows.
A CellRange object containing this row and all its child rows.
The object returned includes all columns.
Returns a reference to a node located at a given position relative to this node.
A value from the enumeration that specifies
the position relative to this node.
A node object.
If the node requested does not exist, returns null (for example,
the root node does not have a previous sibling).
Gets the parent node of this node.
Gets the previous sibling node.
Gets the previous visible sibling node.
Gets the next sibling node.
Gets the next visible sibling node.
Gets the first child node.
Gets the first visible child node.
Gets the last child node.
Gets the first sibling node.
Gets the last sibling node.
Gets the index of this node in the collection.
Gets an array containing the children of this node.
Gets whether any child of node is visible.
Creates a node row at a specified position relative to this node.
A value from the enumeration that specifies
where the new node will be added with respect to this node (e.g. Child, Sibling).
Value of the property for the new node.
Value of the property for the new node.
Value of the property for the new node.
A reference to the new added to the grid.
Creates a node row at a specified position relative to this node.
A value from the enumeration that specifies
where the new node will be added with respect to this node (e.g. Child, Sibling).
Value of the property for the new node.
A reference to the new added to the grid.
Removes this node row and all its child rows (nodes and data) from the grid.
Moves a node to a new position.
A value from the enumeration that specifies
where the node will be moved with respect to its current position.
object to use as a target when the
parameter is set to .
Returns true if the method was successful, false otherwise.
Moves a node to a new position.
A value from the enumeration that specifies where
the node will be moved with respect to its current position.
Returns true if the method was successful, false otherwise.
Ensures that this node is visible, expanding its parent nodes and scrolling it into view if necessary.
Selects the node.
This method sets the control's property.
Sorts this node's child nodes in the specified order.
One or more values from the enumeration that specify
the type of sorting to be applied (e.g. ascending, descending, case-sensitive, etc).
Start of a range of columns to sort.
End of a range of columns to sort.
The grid recognizes two types of row: regular rows which contain data, and node rows which are used
to group data. This method only sorts the row nodes; it does not reorder the data rows within each node.
To sort the data rows, use the grid's method instead.
Sorts this node's child nodes in the specified order.
One or more values from the enumeration that specify
the type of sorting to be applied (e.g. ascending, descending, case-sensitive, etc).
The grid recognizes two types of row: regular rows which contain data, and node rows which are used
to group data. This method only sorts the row nodes; it does not reorder the data rows within each node.
To sort the data rows, use the grid's method instead.
Sorts this node's child nodes using a given object to determine the node order.
An object that implements the interface used
to compare objects. This can be used to provide custom sorting.
The grid recognizes two types of row: regular rows which contain data, and node rows which are used
to group data. This method only sorts the row nodes; it does not reorder the data rows within each node.
To sort the data rows, use the grid's method instead.
Contains flags that specify printing options to use with the method.
Print the grid in actual (screen size). If the grid is too wide to fit on a page, columns spill onto
separate pages. If the grid is too tall to fit on a page, rows spill onto additional pages.
Scale the grid so its width will fit on a single page. If the grid is too tall to fit on a page,
rows spill onto additional pages.
Scale the grid so it will fit on a single page (rows and columns).
Show a page setup dialog before printing so the user can select paper size, orientation, and margins.
Show a print setup dialog before printing so the user can select the printer to use.
Show a print preview dialog before printing so the user can inspect the document before printing it.
Show highlighted selection while printing.
Extend the last column on each printed page.
Represents a class that encapsulates the control printing functionality, including page and printer
settings, headers, and footers.
See also the method.
Gets the object that specifies page and printer settings.
The class is part of the .NET framework, defined in the
System.Drawing.Printing namespace. It contains properties that specify printer and page settings for the document.
Specifies the font to use for rendering page headers.
See also the property.
Specifies the font to use for rendering page footers.
See also the property.
Gets the number of the page being printed (the first page is numbered one).
Applications typically use this property to provide user feedback while printing grids.
Gets the total number of the pages in the print document.
The value returned is accurate only while the document is printing. Before or after
a document is done printing, this property returns zero.
Gets a reference to the used to display the grid's print preview.
Use this property to customize the size and position of the preview dialog when printing the grid
with the option.
The code below uses the PrintPreviewDialog property to display the preview dialog with a
custom caption and in a maximized state:
Form dlg = _flex.PrintParameters.PrintPreviewDialog as Form;
dlg.Text = "Custom Caption";
dlg.StartPosition = FormStartPosition.Manual;
dlg.WindowState = FormWindowState.Maximized;
_flex.PrintGrid("test", PrintGridFlags.ShowPreviewDialog);
Gets or sets the flags that specify printing options to use with the
method. See the enumeration for details.
Gets or sets a string that contains the page headers.
The string may be divided by tab characters into up to three sections. The sections are then
left, center, and right-aligned at the top of each page.
The string may contain placeholders "{0}" and "{1}" which are replaced with the current
page number and total page count.
Use the property to select the font used to render the header.
The code below specifies a right-aligned header with a "Page n of m" display using a 10-point Tahoma font.
_flex.Header = "\t\tPage {0} of {1}";
_flex.HeaderFont = new Font("Tahoma", 10);
_flex.PrintGrid("Header");
Gets or sets a string that contains the page footers.
The string may be divided by tab characters into up to three sections. The sections are then
left, center, and right-aligned at the top of each page.
The string may contain placeholders "{0}" and "{1}" which are replaced with the current
page number and total page count.
Use the property to select the font used to render the footer.
Represents an object that renders a into a
paged .
This class may be used to print multiple grids, along with other
custom content, into an existing object.
To use it, create one PrintDocumentGridRenderer for each
grid you want to print. Then handle the document events and call the
event for the renderers until the value of the
property equals .
The code below renders two grids into a :
// print two grids into an existing PrintDocument
private void button1_Click(object sender, EventArgs e)
{
using (var dlg = new PrintPreviewDialog())
{
dlg.Document = this.printDocument1;
dlg.ShowDialog(this);
}
}
// event handlers for the PrintDocument object on the form
PrintDocumentGridRenderer _g1, _g2;
void printDocument1_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
// create and configure grid renderer for the first grid
_g1 = new PrintDocumentGridRenderer(c1FlexGrid1);
_g1.Options = PrintGridFlags.FitToPageWidth | PrintGridFlags.ExtendLastCol;
// create and configure grid renderer for the second grid
_g2 = new PrintDocumentGridRenderer(c1FlexGrid2);
_g2.Options = PrintGridFlags.FitToPageWidth | PrintGridFlags.ExtendLastCol;
}
void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
// render first grid
if (_g1.CurrentPage < _g1.PageCount)
{
_g1.PrintPage(e);
e.HasMorePages = true;
}
// render second grid
else if (_g2.CurrentPage < _g2.PageCount)
{
_g2.PrintPage(e);
e.HasMorePages = _g2.CurrentPage < _g2.PageCount;
}
}
Initializes a new instance of a .
that will be painted by
this renderer.
Gets or sets the flags that specify printing options to use with the
method. See the enumeration for details.
Gets the index of the page being rendered.
Gets the total number of pages in the document.
Gets or sets the Y coordinate of the first block of cells rendered on
the document.
Renders the current page into the document.
that provides parameters for rendering the page.
Renders a specific page into the document.
that provides parameters for rendering the page.
Index of the page to print.
This method is used to render specific ranges of pages within the document.
Calculates the zoom factor and page breaks in the document.
that contains the page information.
Base class for grid rows and columns ( and classes).
Initializes a new instance of the class.
Gets or sets whether a Row or Column is visible.
This property returns true even if the row or column has been scrolled out of view.
To determine whether a row is currently within view, check the
and properties.
To determine whether a column is currently within view, check the
and properties.
Gets whether this row is collapsed.
Rows are collapsed when one of their parent nodes is collapsed.
Collapsed rows are not visible to the user even if their
property is set to true.
Gets whether this row is currently visible to the user.
This property returns true if the property
is set to true and the row is collapsed (
property returns false).
Gets or sets whether this row or column is selected.
Use this property to get or set the selection state for individual rows when the grid's
property is set to .
Gets or sets user data associated with this row or column.
The UserData value is not used internally by the grid. It is reserved for additional data that
the application may associate with rows or columns.
Gets or sets whether the user can drag this row or column with the mouse.
The grid object also has an property.
If dragging is disabled at the grid level, the user will not be able to drag any rows or columns.
If dragging is allowed by the grid's property, then
dragging of individual rows and columns can still be disabled by setting this property to false.
Gets or sets whether the user can resize this row or column with the mouse.
To resize rows or columns, the mouse must be over the fixed area of the grid, and close to a border
between rows or columns. The mouse pointer will then change into a sizing pointer and the user can drag
the row or column to change the row height or column width.
If a group of columns is selected (from first to last row) and the user resizes one of them, all
selected columns are resized. The same applies to rows.
If column sizing is allowed, users may double-click the resizing area to resize a column so it will
automatically fit the longest entry.
Rows with zero height and columns with zero width can't be resized by the user. If you want to make
them very small but still resizable, set their height or width to one pixel, not to zero.
The and
events fire before resizing starts, and may be used to prevent resizing of specific rows and columns.
The and
fire after resizing, and may be used to validate the user's action and to update the display.
Specifies whether adjacent cells with similar contents will be merged.
Merging cells allows you to display data in a clear, appealing way because it highlights groups of identical
information. It also gives you flexibility to build tables similar to the ones you can create in HTML or using
Microsoft Word, both of which support merged cells.
To create tables with merged cells, you must set the property to a value other
than , and then set the property of individual
rows and columns true for the rows and columns you wish to merge.
After these properties are set, the grid will automatically merge adjacent cells that have the same
contents. Whenever the cell contents change, the grid updates the merging state.
Gets or sets whether cells on this row or column can be edited by the user.
The grid object also has an property.
If editing is disabled at the grid level, the user will not be able to edit any cells.
If editing is allowed by the grid's property, then
editing of individual rows and columns can still be disabled by setting this property to false.
Gets or sets the type of object stored in this row or column.
By default, the column's DataType property is set to , which allows you to store
any data values in the column.
If you set a row or column's DataType to a specific type, the grid will try to convert any values assigned
to cells in that column to the specified data type. If the conversion fails, the grid will fire a
event and the cell value will not be changed.
The DataType property affects how values are stored internally in the grid, how they are sorted, and the
type of control that is used to edit the values in the column. For example, a
control is used to edit values in columns, and check boxes are used to display and edit
values in Boolean columns.
If you want to store times (not dates) in a column, you can still use the DateTime type, but you should
use a that displays only the time, not the date.
Gets or sets a string that specifies how to format the data on this column.
The Format property affects how values are formatted for display, not the values stored internally.
To retrieve the formatted value of a cell, use the property.
The Format string has the same semantics as the format argument in the .NET
method. For details and a complete set of examples, see the .NET documentation.
Gets or sets the input mask to use when editing cells on this column.
The grid also has an property that applies to the entire grid.
For details and mask syntax, refer to that property.
Gets the index of this row or column in its parent collection.
This property returns -1 if the row or column is not a member of the collection.
Gets or sets a custom associated with this row or column.
If the row or column does not have a custom style, this property returns null.
Gets or sets a custom associated with this row or column, creating a new
style if necessary.
This property never returns null. If this element does not have a custom style, a new one will be
created automatically and returned.
The code below sets a column's background color to red.
// get the style associated with column 1 (create a new one if necessary)
CellStyle cs = _flex.Cols[1].StyleNew.BackColor;
// set the new style's back color to red
cs.BackColor = Color.Red;
Gets the style used to display this row or column.
This property never returns null. If the row or column has a custom style, this property returns that style.
Otherwise, it returns the stock style used to display the row (e.g., Normal, Alternate, Fixed, Frozen).
Gets the stock used to paint fixed cells in this row or column.
Gets the custom style associated with fixed cells on this row or column, creating a new one of necessary.
If the row or column has a custom style associated with its fixed cells, this property returns that style.
Otherwise, it creates a new , assigns it to the row or column, and returns a reference
to the new style.
Gets the style used to display fixed cells on this row or column.
If the row or column has a custom style associated with its fixed cells, this property returns that style.
Otherwise, it returns the stock style used to display the column (e.g., Normal, Fixed).
Gets or sets a value that determines how text is aligned in
scrollable cells on this row or column.
This property gets or sets the alignment value specified by the
object associated with the column.
Gets or sets a value that determines how text is aligned in
fixed cells on this row or column.
This property gets or sets the alignment value specified by the
object associated with the fixed cells in the row or column.
Gets or sets an value that determines how images are aligned in
scrollable cells on this row or column.
This property gets or sets the alignment value specified by the
object associated with the column.
Gets or sets an value that determines how images are aligned in
fixed cells on this row or column.
Gets or sets an object used to translate data values into images for this row or column.
Use this property to associate data values in this row or column with images. For example, if a column contains
country names, you can use this property to display the corresponding flags.
Use the property to determine whether the image is displayed instead of or in
addition to the cell text.
Gets or sets a value that determines whether images found in this row or column's should
be displayed instead of or in addition to the cell text.
Gets or sets an object used to translate data values into display values
for this row or column.
The DataMap property allows you to implement "translated" rows or columns. In translated rows or columns,
the grid does not display the values stored in the cells. Instead, it looks up those values in the column's
DataMap and displays the mapped value.
The grid also uses the DataMap value to populate drop-down lists when the column is editable.
Note that the DataMap property has no effect when the property is also
set. Using both properties on a single row or column is legal, but it effectively disables the DataMap.
Gets or sets a list of items to be used by the drop-down editor.
The ComboList property specifies the type of editor to be used when editing a cell. You may use a text box,
drop-down list, drop-down combo, or an edit button to pop up custom editor forms.
To use the ComboList property, set the property to True, and
set the ComboList property to a string that describes the type of editing you want to use for that cell.
The options are described below:
1. To edit the cell using a regular text box, set the ComboList property to an empty string ("").
2. To edit the cell using a drop-down list, set the ComboList property to a string containing the available
options, separated by pipe characters (for example "option 1| option 2").
3. To edit the cell using a drop-down combo, set the ComboList property to a string containing the
available options, separated by pipe characters and starting with a pipe character (for example "|option 1|option 2").
4. To display an edit button, set the ComboList property to a string containing an ellipsis ("...").
Edit buttons look like regular push buttons, aligned to the right of the cell, with an ellipsis as a caption.
When the user clicks on the edit button, the grid fires the event.
In this case, the user can't edit the cell contents directly.
5. To display an edit button next to an editable cell, set the ComboList property to a string containing a
pipe and an ellipsis ("|..."). In this case, you get a regular edit button but the user can also edit the cell
contents directly.
Note that the ComboList property has precedence over the property.
Using both properties on a single row or column is legal, but it effectively disables the DataMap.
Gets or sets the custom editor used to edit cells in this column.
The grid provides several built-in editors that are automatically selected based on the properties of the
cell being edited.
This property allows you to use external editors when editing values in a given column. Any control
can be used as an external editor, but to achieve complete integration with the grid, the external editor should
implement the interface.
You can associate external editors with columns at design time (using the grid's Column Editor) or at run
time, by setting this property.
The code below creates a C1DateEdit control and assigns it to the property of a grid
column. The control will be used to edit cells on this column instead of the default
control.
All controls in the C1Input library implement the interface and can be
used as grid editors without any extra code.
// create C1DateEdit control (included with C1Input)
C1DateEdit dateEdit = new C1DateEdit();
// use the new control as an editor for a grid column
_flex.Cols[1].DataType = typeof(DateTime);
_flex.Cols[1].Editor = c1DateEdit;
Clears the contents of the row or column.
value specifying which elements of the row or
column should be cleared.
Use this method to reset column properties to their default values (width, visibility, style,
user data, and so on). This method only clears the column object itself, it does not clear
the contents of the cells in the column.
Moves this row or column to a new position in the collection.
An integer specifying the new position.
Gets a reference to the control that owns this row or column.
Invalidates an individual row or column, causing it to be repainted.
Class that represents a grid row.
This class does not have a public constructor. You can add and remove rows using methods
in the grid's property, which exposes the row collection.
Gets or sets the cell value specified by the column index in this row.
Gets or sets the cell value specified by the column name in this row.
Gets the position of the top of this row, in pixels, relative to the grid.
The value returned is the sum of row heights from the top of the grid until this row, and
does not account for the scroll position. To account for the scroll position, this value should
be adjusted using the grid's
property.
To retrieve the size and position of a cell, use the method.
Gets the position of the bottom of this row, in pixels, relative to the grid.
The value returned corresponds to the sum of the and properties.
Gets or sets the height of this row, in pixels (the value -1 represents the default row height).
Setting this property to -1 causes the grid to use the default row height for this row
(see the property).
Height returns the height assigned to the row even if the row is invisible, and returns -1
if the row has the default height. To obtain the actual display height of a row, use the
property.
Gets or sets the display height for this row, in pixels.
HeightDisplay returns zero if the row is invisible, and returns the actual display height
even if the property is set to -1 (which stands for default row height).
Gets the index of this row in the collection.
This property returns -1 if the is not a member of the collection.
See also the and properties.
Gets the index of this row in the collection.
This property is similar to the property, except it throws an exception
if the is not a member of the collection.
Gets the index of this row in the collection, excluding fixed and node rows.
This property returns -1 if the row is a fixed or node row.
If the grid is bound to a data source, the return value can be used as an indexer into the grid's data
source to obtain a reference to the item bound to the row.
You can also obtain the underlying data object directly using the row's property.
Gets or sets the text of the first fixed cell in the row.
Indicates the row is a placeholder for adding new rows to the grid.
This property returns true for the last row on the grid when the
property is set to true. This is the row that has an asterisk glyph on the first fixed column.
Gets the object that provides data for this row.
The type of object returned depends on the type of DataSource assigned to the grid. For example,
if the grid is bound to a object, then this property will return the
specific object that is bound to this row.
This property returns null if the grid is unbound, or if the row is a fixed or node row that doesn't
correspond to any objects in the grid's data source.
For an example, see the event.
Clears this row.
value specifying which elements of the row should be cleared.
Use this method to reset row properties to their default values (height, visibility, style, user data, etc.).
Moves a row to a new position in the collection.
An integer specifying the row's new position.
Gets or sets whether this row is a node row in an outline.
This property determines whether the row behaves as a node in an outline tree.
You can use to create custom outline trees, or use the grid's
method to create outline trees automatically.
Gets the object associated with this row.
If the row is a node (see the property), this property returns a
object that can be used to collapse or expand the node, set its level within
the outline tree, etc.
If the row is not a node, this property gets the row's parent node.
Gets or sets whether this row is selected.
Use this property to get or set the selection status for individual rows when the grid's
property is set to .
Invalidates this row, causing it to be repainted.
Class that represents a grid column.
This class does not have a public constructor. You can add and remove
columns using methods in the grid's
property, which exposes the column collection.
Gets or sets the cell value specified by the row index in this column.
Gets the position of the left of this column, in pixels, relative to the grid.
The value returned is the sum of column widths from the left of the grid until this column, and
does not account for the scroll position. To account for the scroll position, this value should
be adjusted using the grid's
property.
To retrieve the size and position of a cell, use the method.
Gets the position of the right of this column, in pixels, relative to the grid.
The value returned corresponds to the sum of the and properties.
Gets or sets the width of this column, in pixels (the value -1 represents the default column width).
Setting this property to -1 causes the grid to use the default column width for this column
(see the property).
Width returns the width assigned to the column even if the row is invisible, and
returns -1 if the row has the default height. To obtain the actual display width of a column,
use the property.
Gets or sets the display width for this column, in pixels.
WidthDisplay returns zero if the column is invisible, and returns the actual display width
even if the property is set to -1 (which stands for default column width).
Gets the index of this column in the collection.
This property is similar to the property, except it throws an exception
if the is not a member of the collection.
Gets the position of the column in the data source object.
This property returns -1 for fixed and unbound columns.
Gets or sets that cells in the will accept null value or null will be replaced by default value in unbound mode.
This property works only if IsValueType member of property
equals to True and for type .
If value was changed to False then all null values in the will be
replaced by defaults of current .
Gets or sets whether this column can be sorted by clicking on the column header.
The grid has an property that determines whether columns can be
sorted with the mouse. The AllowSorting property of the objects can be used to prevent
the user from sorting specific columns.
Gets or sets this type of filter to use for this column.
The grid has an property that determines whether
columns can be filtered by the user. If that property is set to true, then filters are created
automatically for each column based on the setting of the column's
property.
The grid provides condition and value filters. Condition filters allow users to specify
conditions such as 'value > 10'. Value filters allow users to select values that should be displayed
from a list of values present in the data source. All filters can be customized in code as shown
in the examples below.
The code below customizes the filters for two columns. The "ShipRegion" column is initialized to
show only two states, AK and CA. The "UnitPrice" column is initialized to show only items with
unit price greater than $30. After the column filters have been initialized, the code calls the
method to apply the filters.
// initialize "ShipRegion" column filter to show only two values: "AK" and "CA"
var col = _flex.Cols["ShipRegion"];
col.AllowFiltering = AllowFiltering.ByValue;
var vf = col.Filter as ValueFilter;
vf.ShowValues = new object[] { "AK", "CA" };
// initialize "UnitPrice" column filter to show only values greater than $30
col = _flex.Cols["UnitPrice"];
col.AllowFiltering = AllowFiltering.ByCondition;
var cf = col.Filter as ConditionFilter;
cf.Condition1.Operator = ConditionOperator.GreaterThan;
cf.Condition1.Parameter = 30;
// apply both column filters to the data
_flex.ApplyFilters();
Gets or sets the responsible for filtering this column.
Gets the that is currently filtering this column.
Gets or sets the name of this column.
The name can be used as an index in the property indexer.
When the grid is bound to a DataSource, the column names are set automatically to the names
of columns in the data source, and are used for binding.
Specifies how this column should be sorted when the method is called
with a flag.
Use this property when you want to sort multiple columns in different orders. For example, you could
set the Sort property to for columns 1, 2, and 3, and to
for columns 4, 5, and 6.
You would then call the grid's method with the sort parameter
set to to perform the sort using the order specified for each column.
Gets the index of this column in the collection.
Returns -1 if the column is not a member of the collection.
Gets or sets whether this column is selected.
Invalidates this column, causing it to be repainted.
Gets or sets the text of the column's header cell.
Clears this .
value specifying which elements of the
should be cleared.
Moves a to a new position in the collection.
An integer specifying the column's new position.
Gets or sets when to display combo buttons in cells.
By default, the column will show editing buttons in cells only when they
have the focus. This is the same behavior used by the
control.
If you set to ,
the column will display buttons on any cells that have associated lists, even if they
don't have the focus.
For details on how to associate lists with cells, see the ,
, and properties.
Base class for grid row and column collections (
and classes).
Gets or sets the number of rows or columns in the collection.
Gets or sets the number of fixed rows or columns in the collection.
Gets or sets the number of frozen rows or columns in the collection.
Use the property to determine whether
the user can freeze rows or columns with the mouse.
Moves a row or column to a new position in the collection.
Index of row or column to be moved.
New position.
Moves a range of rows or columns to a new position in the collection.
The index of the first row or column in the range to be moved.
The number of rows or columns that will be moved.
New position.
Determines whether the collection contains a given row or column.
Row or column items to be detected.
True if the row or column is a member of the collection, False otherwise.
Gets or sets the minimum size for rows and columns in the collection.
The MinSize property limits the minimum size of rows or columns when they are resized by the user or
adjusted to fit the contents with the or
method.
Gets or sets the maximum size for rows and columns in the collection.
The MaxSize property limits the maximum size of rows or columns when they are resized by the user or
adjusted to fit the contents with the or
method.
Setting this property to zero disables it.
Gets or sets the default size of the rows or columns in the collection (in pixels).
This value is set automatically when the grid's property changes.
The default size is used when the row's Height property or columns Width property is set to -1.
Gets a reference to the control that owns this collection.
Gets the index of the previous visible row or column.
Index of the original row or column.
Index of the previous visible row or column.
Gets the index of the next visible row or column.
Index of the original row or column.
Index of the next visible row or column.
Updates the position of rows or columns.
Collection of grid objects.
Gets the at the specified index.
Use the object returned by this method to set attributes such as row
height, visibility, style, selected state, and so on.
Gets or sets the number of rows in the collection.
You can add or remove rows by assigning a new value to this property, or you can use the
, , , and methods.
Gets or sets the index of the row used to display the sorting and filtering glyphs.
The default value is -1, which causes the sorting and filtering glyphs to be shown
on the last fixed row. If you set this property to a value larger than the number
of fixed rows, then the glyphs will not be displayed.
Gets or sets the number of fixed rows in the collection.
Gets a collection of objects that are currently selected.
This property is especially useful when the grid's property
is set to .
The code below removes all selected rows from the grid.
Note that foreach loops can't be used to modify the collections being iterated over. This example
works because the collection is being enumerated while the
collection is being modified.
// delete all selected rows
foreach (Row r in _flex.Rows.Selected)
{
_flex.Rows.Remove(r);
}
Appends a new object to the collection.
The Add method appends a new row to the collection. To insert a row at a specific position,
use the method.
A reference to the that was added to the collection.
Appends a given number of objects to the collection.
Number of rows to add to the collection.
Adds a new object to the collection at a specified position.
The position where the new row will be inserted.
A reference to the that was added to the collection.
Adds a new row to the row collection at a specified position.
The position where the new node row will be inserted.
Outline level for the new node row.
A reference to the that was added to the collection.
This method is especially useful when the grid is bound to a data source, because in this
case you can't change the value of the property. When the grid
is unbound, you can add rows and turn them into nodes later using the property.
Appends a new row to the row collection.
Outline level for the new node row.
A reference to the that was added to the collection.
Adds a range of rows to the collection at a specified position.
The position where the new range will be inserted.
The number of rows to add.
Removes a object from the collection.
The index of the row to remove from the collection.
A reference to the that was removed from the collection.
Removes a object from the collection.
The row to be removed.
A reference to the that was removed from the collection.
Removes a range of rows from the collection.
The index of the first row to remove from the collection.
The number of rows to remove from the collection.
Move a object to a new position in the collection.
Index of row to be moved.
New position for the row.
Moves a range of rows to a new position in the collection.
The index of the first row in the range that will be moved.
The number of rows that will be moved.
New position for the first row in the range.
Updates the position and data index of each row in this collection.
Collection of grid objects.
Gets the at the specified index.
Gets the that has the specified column name.
You can use the object returned by this method to set
attributes such as column height, visibility, style, selected state, and so on.
This indexer looks for a column with the specified .
The column name is set automatically for you when the grid is bound to a database,
or it may be set using code.
Gets a value that determines whether the collection contains a with the given name.
Column name to look for (case-insensitive).
True if the collection contains a column with the given name, False otherwise.
Gets the index of the with the specified name.
Column name to look for (case-insensitive).
Index of the column that has the given name in this collection, or -1 if the collection
does not contain a column with the given name.
Gets the index of the with the specified name. The search starts at a specified index.
Column name to look for (case-insensitive).
The search starting index.
Index of the column that has the given name in this collection, or -1 if the collection
does not contain a column with the given name.
Gets the index of the with the specified name, optionally
throwing an exception if the column is not found.
Column name to look for (case-insensitive).
Whether to throw and exception if the column cannot be found.
Index of the column that has the given name in this collection, or -1 if the collection
does not contain a column with the given name.
If the parameter is set to true and
a column named cannot be found, the control throws
an . This makes it easier to write
compact code that relies on column names.
The example below uses the IndexOf method to convert column names into
indices. Note that if the column names are invalid, the exception will be thrown
by the IndexOf method (column not found) rather than in the following
method, where it would not be as clear (invalid index).
int columnIndex = _flex.Cols.IndexOf("total");
_flex.AutoSizeCol(columnIndex);
Gets the index of the with the specified name, optionally
throwing an exception if the column is not found. The search starts at a specified index.
Column name to look for (case-insensitive).
Whether to throw and exception if the column cannot be found.
The search starting index.
Index of the column that has the given name in this collection, or -1 if the collection
does not contain a column with the given name.
If the parameter is set to true and
a column named cannot be found, the control throws
an . This makes it easier to write
compact code that relies on column names.
The example below uses the IndexOf method to convert column names into
indices. Note that if the column names are invalid, the exception will be thrown
by the IndexOf method (column not found) rather than in the following
method, where it would not be as clear (invalid index).
int columnIndex = _flex.Cols.IndexOf("total");
_flex.AutoSizeCol(columnIndex);
Gets or sets the number of objects in this collection.
You can add or remove columns by assigning a new value to this property, or you can use the
, , , and methods.
Gets or sets the number of fixed columns in this collection.
Appends a new object to this collection.
A reference to the that was added to the collection.
Appends a given number of objects to the collection.
Number of columns to add to the collection.
This method adds the new columns to the end of the collection. To insert columns at specific
positions, use the or methods.
Adds a new object to this collection at a specified position.
The position where the new column will be inserted.
A reference to the that was inserted to the collection.
Adds a range of objects to the collection at a specified position.
The position where the new range will be inserted.
The number of columns to add.
Removes a object from the collection.
The index of the column to remove from the collection.
A reference to the that was removed from the collection.
Removes a object from the collection.
The column to remove.
A reference to the that was removed from the collection.
Removes a object from the collection.
Name of the column to remove.
A reference to the that was removed from the collection.
Removes a range of objects from the collection.
The index of the first column to remove from the collection.
The number of columns to remove from the collection.
Moves a object to a new position in the collection.
Index of the column to be moved.
New position for the column.
Moves a range of objects to a new position in the collection.
The index of the first column in the range that will be moved.
The number of columns that will be moved.
New position for the first column in the range.
Gets a collection of objects that are currently selected.
Gets a string build a string that contains a complete description of
the column collection, suitable for persisting the control state.
Whether to include default values in the description.
A string that describes the column collection.
Parses a string containg a description of the column collection (usually obtained
by calling the method) and applies it to a grid.
Grid that receives the column collection.
String that contains the column collection definition.
True if the column definition was applied successfully.
Specifies the type of file to save or load with the
and methods.
Text file, cells separated with commas.
Text file, cells separated with tabs.
Text file, cells separated with the character specified by the
property.
Microsoft Excel files (Xls/biff-8 or OpenXml formats).
Specifies options for use with the and
methods.
Use default settings.
Include fixed cells when loading or saving the grid.
Save only visible rows and columns.
Save only selected rows.
Save values as displayed (including formatting and mapping where available).
This flag has no effect when saving text files, which always contain values as displayed.
Save merged ranges when exporting to Excel with the method.
This flag has no effect when saving text files, it only affects Excel output.
Load merged ranges when importing from Excel with the method.
This flag has no effect when loading text files, it only affects Excel input.
Save and load merged ranges when exporting to or importing from Excel with the
and methods.
Do not freeze rows and columns when exporting to or importing from Excel with the
and methods.
Load or save file in OpenXml (Office 2007) format.
Save nodes as Excel groups when exporting to Excel.
Specifies the type of selection provided by the grid.
The user can select continuous blocks of cells using the keyboard and the mouse.
Clicking on header cells selects entire rows and columns.
The user can select only a single cell at a time.
The user can select continuous blocks of cells using the keyboard and the mouse.
Clicking on header cells does not affect the selection.
The user can select a single row at a time.
The user can select a range of contiguous rows at a time.
The user can select a single column at a time.
The user can select a range of contiguous columns at a time.
The user can select non-contiguous rows using control-click.
This enumeration is for internal use only.
No movement.
One cell left, then wrap to previous row.
One cell right, then wrap to next row.
One cell up.
One cell down.
One cell left.
One cell right.
Page up.
Page down.
Page left.
Page right.
Top cell.
Bottom cell.
Leftmost cell.
Rightmost cell.
Enumeration used to retrieve objects from the
collection.
Cell styles can be retrieved from the collection using the
indexer or the style name. Built-in styles can also be obtained directly through read-only properties.
The code below shows three ways to obtain a reference to a grid's default style:
// s1, s2, and s3 are all references to the grid's Normal style:
CellStyle s1 = _flex.Styles[CellStyleEnum.Normal];
CellStyle s2 = _flex.Styles["Normal"];
CellStyle s3 = _flex.Styles.Normal;
Style used to render scrollable normal cells.
This is the parent style for most cells. Setting the control's BackColor,
ForeColor, or Font properties automatically sets the corresponding properties
on the Normal style.
If you change any properties in the Normal style, the changes will be reflected
in all styles that do not explicitly override those properties.
Style used to render scrollable cells in even-numbered rows.
Style used to render fixed cells.
Style used to render cells that are selected and highlighted.
Style used to render the cell that has the focus.
Style used to render cells being edited.
Style used to render cells that are being selected as the user types (see the property).
Style used to render cells that are frozen (editable and selectable, but not scrollable).
Style used to render cells that are frozen (editable and selectable, but not scrollable) in even-numbered rows.
Style used to render the last row on the grid when the property is set to true.
Style used to render the area of the grid where there are no cells.
Style used to render selected column headers.
Style used to render selected row headers.
Style automatically assigned to grand total nodes created with the method.
Style automatically assigned to level-0 nodes created with the method.
Style automatically assigned to level-1 nodes created with the method.
Style automatically assigned to level-2 nodes created with the method.
Style automatically assigned to level-3 nodes created with the method.
Style automatically assigned to level-4 nodes created with the method.
Style automatically assigned to level-5 nodes created with the method.
Style used to paint the filter editors.
Constant that indicates the first custom style.
Specifies how text is aligned in a grid cell.
Text is horizontally aligned to the left and vertically aligned to the top of the cell.
Text is horizontally aligned to the left and vertically aligned to the center of the cell.
Text is horizontally aligned to the left and vertically aligned to the bottom of the cell.
Text is horizontally aligned to the center and vertically aligned to the top of the cell.
Text is horizontally aligned to the center and vertically aligned to the center of the cell.
Text is horizontally aligned to the center and vertically aligned to the bottom of the cell.
Text is horizontally aligned to the right and vertically aligned to the top of the cell.
Text is horizontally aligned to the right and vertically aligned to the center of the cell.
Text is horizontally aligned to the right and vertically aligned to the bottom of the cell.
Numbers are aligned to the right, other values to the left, and vertically aligned to the top.
Numbers are aligned to the right, other values to the left, and vertically aligned to the center.
Numbers are aligned to the right, other values to the left, and vertically aligned to the bottom.
Specifies a 3D effect to use when rendering cell text.
No 3D effect.
Text is drawn with a shadow offset by one pixel to the right and below the text.
Text is drawn with a shadow offset by one pixel to the left and above the text.
Specifies how images are aligns in grid cells.
Image is horizontally aligned to the left and vertically aligned to the top of the cell.
Image is horizontally aligned to the left and vertically aligned to the center of the cell.
Image is horizontally aligned to the left and vertically aligned to the bottom of the cell.
Image is horizontally aligned to the center and vertically aligned to the top of the cell.
Image is horizontally aligned to the center and vertically aligned to the center of the cell.
Image is horizontally aligned to the center and vertically aligned to the bottom of the cell.
Image is horizontally aligned to the right and vertically aligned to the top of the cell.
Image is horizontally aligned to the right and vertically aligned to the center of the cell.
Image is horizontally aligned to the right and vertically aligned to the bottom of the cell.
Image is scaled to fit the maximum area within the cell while preserving the original aspect ratio.
Image is stretched to cover the whole cell.
Image is tiled to cover the whole cell.
Image is not displayed.
Image is split into a grid, corner parts are copied and center is stretched to cover the cell.
This tiling mode preserves the corners and borders of the source image, and is designed to be
used with the property.
Specifies whether a style should display the cell text, image, both, or none.
Display text only (no image).
Display image only (no text).
Display the text over the image.
Display the text next to the image.
Nothing (cell stays blank).
Specifies the direction to use when rendering text in a grid cell.
Text is rendered in the horizontal direction.
Text is rendered from the bottom of the cell to the top.
Text is rendered from the top of the cell to the bottom.
Specifies the type of cell border to display.
No border.
Solid flat border.
Double border.
Raised border.
Inset border.
Groove border.
Fillet border.
Dotted border.
Specifies the direction of cell borders.
Draw cell borders in both directions.
Draw cell borders only in the horizontal direction.
Draw cell borders only in the vertical direction.
Contains flags that specify which style elements are defined in a object.
This enumeration can be used to inspect styles and determine which elements it defines, and it
can also be used to clear specific elements from the style.
Any elements not defined in the style are inherited from the parent style.
No elements are defined.
The style defines a font.
The style defines a background color.
The style defines a foreground color.
The style defines margins.
The style defines borders.
The style defines the text alignment.
The style defines a 3D effect for the text.
The style defines the image alignment.
The style defines the spacing between images and text.
The style defines how long strings are trimmed to fit within cells.
The style defines whether long strings are allowed to wrap within cells.
The style defines whether to display text and/or images, in the cells.
The style defines a format string used to convert data into strings.
The style defines an edit mask used to constrain values entered in the cells.
The style defines a list of choices used to populate drop down editors.
The style defines an used to associate cell data with images.
The style defines the of values contained in the cells.
The style defines an used to associate cell data with display values.
The style defines whether text should be rendered horizontally or vertically.
The style defines an external control to be used as an editor for the cells.
The style contains arbitrary user data (not used by the control).
The style specifies a background image.
The style specifies a background image alignment.
The style defines a background color of found text.
All style elements.
Collection of objects defined for a grid.
Gets the default style used to paint scrollable cells.
Gets the style used to paint scrollable cells in alternate rows.
This style is empty by default, so all scrollable cells are rendered using the style.
Gets the style used to paint fixed cells.
Gets the style used to paint selected column headers.
Gets the style used to paint selected column headers.
Gets the style used to paint highlighted selected cells.
Use the property to determine whether cells should be
highlighted when the control does not have the focus.
Use the property to determine what types of selection
are allowed.
Gets the style used to paint the current cell when the control has focus.
This style is empty by default, so focused cells are rendered using the style.
Gets the style used to paint the cell being edited.
This style is empty by default, so cells being edited are rendered using the style.
Gets the style used to paint the cell selected while auto-searching.
Use the property to enable auto-searching.
Gets the style used to paint frozen cells (frozen cells are editable and selectable, but not scrollable).
Gets the style used to paint frozen cells (frozen cells are editable and selectable, but not scrollable) in alternate rows.
This style is empty by default, so frozen cells are rendered using the style.
Gets the style used to paint cells in the new row template at the bottom of the grid.
The new row template is only present when the property is set to true.
Gets the style used to paint the area of the grid below and to the right of all the cells.
Only the and elements of
this style are used. They define the appearance of the space between the last cell and the edges of
the control.
The value defines the color of the lines drawn around the
edge of the sheet and between frozen and scrollable cells.
Gets the style used to paint the column filter editors.
This style is only used if the grid's property
is set to true.
Gets a by index.
Gets a built-in by style type.
Gets a by name.
If the specified name doesn't exist, this indexer returns null.
Gets the number of objects in the collection.
Adds a new object to the collection.
Name of the new style.
Base style, used to initialize the properties of the new style.
The new object.
If a style with the given name already exists, the existing style is returned and no
exception is thrown.
Adds new object to the collection.
Name of the new style.
Name of the base style, used to initialize the properties of the new style.
The new object.
Adds a new empty object to the collection.
Name of the new style.
The new object.
Removes a custom style from the collection.
Index of the style to be removed.
Built-in styles can't be removed.
Removes a custom style from the collection.
Name of the style to be removed.
Built-in styles can't be removed.
Removes a custom style from the collection.
Style to be removed from the collection.
Built-in styles can't be removed.
Clear all styles (even those in use) and reset the built-in styles.
The Clear method also removes any custom styles assigned to rows, columns,
and cells.
Clear all unused styles.
Unused styles are unnamed styles that were created and are no longer assigned to
any grid elements.
Checks whether the collection contains a given style.
Name of the style to look for.
True if the collection contains a style called , false otherwise.
Gets the index of a style in the collection.
Style object to look for.
Index of the style in the collection, or -1 if the style is not a member of the collection.
Builds and returns a compact string representation of the style collection.
Whether styles with no attributes should be included.
A compact string representation of the style collection.
This method is used internally to implement design-time persistence.
It can also be used for implementing 'skins', by saving the current styles into
a collection and later applying them to the grid using the method.
Parses a string containing style definitions.
String containing style definitions.
True if the string was parsed successfully, false otherwise.
The style definition string is usually obtained from a call to method.
The new definitions are merged with the current ones. To completely replace the styles,
call the method before parsing the new styles.
The class encapsulates properties that control the appearance of grid cells.
This information includes the background and foreground colors, font, text and image alignment, etc.
The property exposes a collection of grid styles, and has
methods for creating and removing styles from the grid.
You can create and define styles at design time, but right-clicking the grid and selecting the
"Edit Styles" menu option.
Styles follow a hierarchical model similar to styles in Microsoft Word or in cascading style sheets.
Every property in a object may be left unassigned, in which case the value is
inherited from a parent style. The parent style is usually the built-in
style.
To determine which elements are defined in a particular style, use the
property.
When you modify the properties of a object, all cells that use that style
are automatically repainted to reflect the changes.
Styles may be assigned to , , and
objects, as shown in the example below.
The example below creates three objects and assigns them to grid rows, columns,
and cell ranges.
// create style with red background
CellStyle cs = _flex.Styles.Add("red");
Style.BackColor = Color.Red;
// create style with green background
cs = _flex.Styles.Add("green");
Style.BackColor = Color.Green;
// create style with bold font
cs = _flex.Styles.Add("bold");
Style.Font = new Font("Tahoma", 8, FontStyle.Bold);
// assign red style to a column
_flex.Cols[3].Style = _flex.Styles["red"];
// assign green style to a row
_flex.Rows[3].Style = _flex.Styles["green"];
// assign bold style to a cell range
CellRange rg = _flex.GetCellRange(2, 2, 4, 4);
rg.Style = _flex.Styles["bold"];
After running this code, the third column of the grid will be painted with a red background. The
third row will be painted with a green background. The cell at the intersection will be painted
in red, because column styles have priority over row styles. The remaining style elements for these
cells (font, alignment, etc) are not defined in the new styles and are automatically inherited from
the parent style ().The cells around the intersection will have a bold font. The style that defines the bold font
does not specify a background color, so that element is inherited from the parent style, which may be
the "red", "green", or "normal" styles.
Gets or sets the style name.
Style names must be unique. Setting a style name to the name of an already existing
style will throw an exception.
Style names must have one or more characters and may not include curly braces ('{' and '}').
Gets or sets the color used to paint the cell background.
Gets or sets the color of the text in the cell.
Gets or sets the color of the text in the cell.
Gets or sets the font used to paint text in the cell.
Setting the control's Font property automatically sets the Font
property of the Normal style.
Gets or sets the margins between the edges of the cell and its contents, in pixels.
Gets or sets whether long strings should automatically wrap within the cell.
This property determines whether the grid should automatically break
long strings that contain spaces and display them in multiple lines.
String that contain hard line breaks (vbCrLf or "\n\r") are always
displayed in multiple lines.
Gets or sets how long strings are trimmed to fit the cell.
Gets or sets the text alignment.
Gets or sets the 3D effect used to paint text.
Gets or sets the text direction.
Cells containing vertical text can wrap and be auto sized as usual.
Gets or sets the image alignment.
Gets or sets the space between images and text in a cell, in pixels.
Gets or sets whether to show images, text, or both.
Gets or sets the format string used to display values.
Gets or sets the mask string used to edit values.
Gets or sets a pipe-delimited list of valid values.
If the cell is editable, this list of values is used to populate the drop-down
used to edit the cell.
If the list starts with a pipe character, then the list is not exclusive and the
user may type values that are not on the list.
If the list contains three periods ("..."), then a button is displayed in the
cell. When the user presses the button, the grid fires the
event.
If the list contains a pipe followed by three periods ("|..."), then a button is
displayed in the cell as before, and the user may also type into the cell.
See also the property for an alternate way of specifying
valid values for a cell.
Gets or sets an used to associate cell values with images.
Gets or sets an used to associate cell values with display values.
If the cell is editable, this list of values is used to populate the drop-down
used to edit the cell. In this case, the order of the items in the
combo list is determined by the order of the elements in the dictionary.
The most common dictionary class, , uses arbitrary order.
If you want control over the item order, use a different dictionary class such as
.
The C1FlexGrid assembly also includes a class,
which can be used to create multi-column and data-bound dictionaries.
Gets or sets the data type for the style.
When the grid is bound to a data source, this property is set automatically based on the
data schema.
This property is used to coerce values assigned to cells into the proper type.
Gets the CellBorder object associated with this style.
Gets or sets the custom editor used to edit cells that have this style.
The grid provides several built-in editors that are automatically
selected based on the properties of the cell being edited.
This property allows you to use external editors when editing values
that have a given . Any control can be used as an
external editor, but to achieve complete integration with the grid, the
external editor should implement the interface.
For details, see the property.
Gets or sets arbitrary user data associated with this style.
This data is not used by the control, and can be used to store any data that is
useful to the application.
Gets or sets the style's background image.
This property works with to determine
whether and how background images are rendered in cells.
Gets or sets the a value that determines how the style will scale and
position background image.
This property works with to determine
whether and how background images are rendered in cells.
Gets or sets which elements are defined in this style.
Elements that are not defined in a particular style are automatically
inherited from the ancestor style (usually the Normal style).
For example, if you create a custom style that defines the
property, all other elements (back color,
alignment, and so on) are inherited from the ancestor style, which may
be the Normal style or another custom style assigned to a row or
column.
Clears selected elements from this style.
Clears all elements in this style.
Copies all elements defined in a source style to this style.
This method is used to create styles preserving existing style elements
such as or .
The code below changes a column so it looks like a fixed column, without
modifying the column's data type, alignment, etc.
// create a new style
CellStyle cs = _flex.Styles.Add("newStyle");
// set data type, alignment
cs.DataType = typeof(int);
cs.TextAlign = TextAlignEnum.CenterCenter;
// copy remaining elements from "Fixed" style
cs.MergeWith(_flex.Styles.Fixed);
// assign new style to grid column
_flex.Cols[col].Style = cs;
Returns a compact string representation of this .
A string containing the settings of all style elements defined in this CellStyle.
This method is used to persist grid styles and can be used to define and save 'skins'.
See the and
methods.
The string returned contains definitions only for the style elements that are defined by this
. Elements inherited from other styles are not included. To build a string containing
specific elements, use the method instead.
The code below creates a style with a custom font and background color and builds a string that represents
the new style. Then it uses the string to initialize a second style.
// create style with custom font and back color
CellStyle cs = _flex.Styles.Add("s1");
cs.Font = new Font("Arial", 12, FontStyle.Bold);
cs.BackColor = Color.Beige;
// save style definition into a string
string styleDef = cs.BuildString();
// use string to initialize another style
CellStyle csNew = _flex.Styles.Add("s2");
csNew.ParseString(styleDef);
// compare styles
Debug.Assert(csNew.Font.Equals(cs.Font));
Debug.Assert(csNew.BackColor.Equals(cs.BackColor));
Returns a string representation of this .
that specifies which style elements should be included in the string.
A string containing the settings of the specified style elements.
This method is used to persist grid styles and can be used to define and save 'skins'.
See the and
methods.
The code below shows the effect of specifying different values for the parameter. It builds
one compact string containing only the elements actually defined in a style, and another including all style elements.
// build compact and a long style definition strings
string s1 = _flex.Styles.Fixed.BuildString();
string s2 = _flex.Styles.Fixed.BuildString(StyleElementFlags.All);
// show both style definitions
Console.WriteLine("{0}: {1}", s1.Length, s1);
Console.WriteLine("{0}: {1}", s2.Length, s2);
Rebuilds this style based on a description contained in a string.
True if the string was successfully parsed, false otherwise.
This method is used to persist grid styles and can be used to define and save 'skins'.
See the and
methods.
Renders a string and an image into a object using this style.
object to render into.
Area where the element will be displayed.
Text to render.
Image to render.
Combination of that determines which elements will be rendered.
This method allows using objects to render objects outside the grid. It can be
useful when implementing owner-drawn applications and style editors for example.
Renders a string and an image into a object using this style.
object to render into.
Area where the element will be displayed.
Text to render.
Image to render.
Renders a string and an image into a object using this style.
object to render into.
Area where the element will be displayed.
Text to render.
Renders a string and an image into a object using this style.
object to render into.
Area where the element will be displayed.
Image to render.
Gets the element used for rendering
strings when the
property is set to true.
Gets the content portion of a cell's rectangle.
Cell rectangle.
A rectangle that represents the content portion of a cell, discounting the
area taken up by the cell borders.
Gets the text portion of a cell's rectangle.
Cell rectangle.
Image that shares the cell space with the text.
A rectangle that represents the text portion of a cell, discounting the
area taken up by the cell borders, padding, and images.
Gets the image portion of a cell's rectangle.
Cell rectangle.
Image to be displayed on the cell.
A rectangle that represents the image portion of a cell, discounting the
area taken up by the cell borders and padding.
Determines whether two objects are equal.
Style to compare with this style.
True if the two styles are equal, false otherwise.
Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
A hash code for the style instance.
The class encapsulates properties that control the appearance of borders in
objects.
Gets or sets the border style.
Gets or sets the border direction.
Gets or sets the border color (except for 3D borders).
3D borders are always drawn using the system colors defined for highlights and shadows.
Gets or sets the border width (except for 3D borders).
3D borders are always one or two pixels wide.
Specifies the appearance of the outline tree.
Do not show the outline tree.
Show tree lines next to node rows.
Show expand/collapse symbols on node rows.
Show outline buttons across the top fixed row.
Show tree lines next to all rows (nodes and data).
Combination of , , and
.
Combination of and .
Combination of , ,
and .
Combination of , , and
.
The GridTree class encapsulates properties that specify the appearance, position, and behavior of the outline tree.
Each grid has a single GridTree object, which can be obtained using the property.
Resets the object.
Gets or sets the color of the lines in the outline tree.
See also the property.
Gets or sets the line style used to draw the outline tree.
By default, this property is set to DashStyle.Dot, which causes the tree
to be drawn with dotted lines. You can change the value of this property to draw the
tree using solid lines instead.
Gets or sets the style of the outline tree.
Use the Style property to determine whether the outline tree should include lines connecting
the nodes and buttons for collapsing and expanding the nodes. See the
enumeration for details.
Use the property to determine where the grid will show the outline tree.
Gets or sets the index of the column where the outline tree is displayed.
By default, this property is set to -1, which causes the tree to be hidden.
Gets or sets the indentation, in pixels, of each tree level.
If you set the Indent property to a value that is too narrow to fit the and
images, the grid will adjust it to fit the images.
Gets or sets the image displayed next to collapsed nodes.
Setting this property to null resets it and causes the grid to use the default image (a plus sign).
To hide the images, use the property.
Gets or sets the image displayed next to expanded nodes.
Setting this property to null resets it and causes the grid to use the default image (a minus sign).
To hide the images, use the property.
If True then the collapse/expand button will not be displayed if all children of node are invisible.
Expands all nodes up to the specified level, collapses others.
The level to show. Any nodes with higher than this
will be collapsed, others will be expanded.
Gets the level of the deepest node in the outline.
This property can be used with methods that take an outline level as
a parameter (for example, and ).
Sorts all nodes at the given level.
Level of the nodes to sort.
value that controls sort direction and options.
Start of the range of columns to sort.
End of the range of columns to sort.
The grid recognizes two types of row: regular rows which contain data, and node rows which are used
to group data. This method only sorts the row nodes; it does not reorder the data rows within each node.
To sort the data rows, use the grid's method instead.
Sorts all nodes at the given level using the specified comparer.
Level of the nodes to sort.
An object that compares objects.
Static class containing UI strings used by the designer.
StyleContext contains a base Style definition and a list of
named Styles. It provides the following services:
- Style management (create, edit, and remove Styles)
- Style inheritance mechanism
- Rendering and measuring methods
Style contains a collection of arbitrary attributes,
represented by a name/object entry, a reference to a parent
Style, and a reference to the containing StyleContext.
Specifies the type of border to be drawn around the control.
No border.
A single-line border.
A three-dimensional border.
A light sunken border.
A border drawn using XP themes.
Base class for controls that support auto-scrolling behavior.
This class is similar to , but provides
extra customization, better scroll notification, and support for scroll tracking.
Creates a new instance of a class.
Gets or sets which scroll bars should appear on the control.
Scroll bars are displayed only if the contents of the control extend beyond its
client area. For example, if is set to ,
a horizontal scroll bar is displayed only if the control is not wide enough to display all
columns at once.
Even when it has no scrollbars, the control will still scroll to keep the selection visible.
If you want to prevent scrolling, handle the event and
set its parameter to true.
You can force the control to display scrollbars at all times with the
property.
You can determine which scrollbars are currently visible with the
property.
Gets or sets the location of the auto-scroll position.
Use the property to get or set the scroll position using pixel coordinates.
Use the and properties to get or
set the scroll position using cell coordinates.
This code binds two grids (_flexLeft and _flexRight) together and synchronizes their scrolling in the vertical
direction (the user can scroll the grids independently in the horizontal direction).
// bind grids together
_flexRight.DataSource = _flexLeft;
_flexLeft.ScrollBars = ScrollBars.Horizontal;
// synchronize vertical scrolling
// (this handles the AfterScroll event for both grids)
void flex_AfterScroll(object sender, C1.Win.C1FlexGrid.RangeEventArgs e)
{
// update sender grid (could be _flexLeft or _flexRight)
C1FlexGrid.C1FlexGrid src = ((C1FlexGrid)sender);
src.Update();
// get new vertical position from sender grid
int y = src.ScrollPosition.Y;
// apply new vertical position to the other grid
if (src.Equals == _flexLeft)
{
_flexRight.ScrollPosition = new Point(_flexRight.ScrollPosition.X, y);
}
else
{
_flexLeft.ScrollPosition = new Point(_flexLeft.ScrollPosition.X, y);
}
}
Gets or sets the type of border around the control.
Gets a value that indicates which scrollbars are currently visible.
Maintains performance by preventing the control from updating itself until
the method is called.
Resumes updating the control after calls to the method.
Called when the control receives a WM_THEMECHANGED message.
The WM_THEMECHANGED message is broadcast to every window following a
theme change event. Examples of theme change events are the activation of a
theme, the deactivation of a theme, or a transition from one theme to another.
Called when the control receives a WM_IME_STARTCOMPOSITION message.
The WM_IME_STARTCOMPOSITION message is sent immediately before the IME generates
the composition string as a result of a keystroke. The message is a notification to
an IME window to open its composition window. An application should process this
message if it displays composition characters itself.
Called after the control scrolls (see the property).
value that indicates the scroll direction.
Called before the controls displays a scroll tip.
New value for the vertical scrollbar.
Gets a rectangle that defines the scrollable portion of the control.
Builds a rectangle that defines the scrollable portion of the control for a given pair of scroll offsets.
Horizontal scroll offset.
Vertical scroll offset.
A that defines the scrollable portion of the control.
This method is for internal use. It allows derived classes to customize the control scrolling behavior.
Raises the event.
A that contains the event data.
Raises the event.
An that contains the event data.
Raises the event.
A that contains the event data.
Raises the event.
An that contains the event data.
Calculates the new position of a scrollbar in response to a user command.
Scroll command (SB_LINEUP, etc).
True for the vertical scrollbar, false for the horizontal scrollbar.
Current scrollbar position.
Scrollbar thumb position.
The new position for the scrollbar.
Derived classes may override this method to customize the scrolling behavior.
Specifies a visual style to use when rendering the control.
Do not use any visual styles. Render the control using the styles and properties only.
Render the control with an appearance based on the current system settings.
Render the control with an appearance based on the Office 2007 Blue color scheme.
Render the control with an appearance based on the Office 2007 Silver color scheme.
Render the control with an appearance based on the Office 2007 Black color scheme.
Render the control with an appearance based on the Office 2010 Blue color scheme.
Render the control with an appearance based on the Office 2010 Silver color scheme.
Render the control with an appearance based on the Office 2010 Black color scheme.
Represents an abstract base class for custom grid renderers.
To create custom grid renderers, inherit from this class, override the appropriate
virtual methods and properties, and assign an instance of your class to the grid's
property.
Represents the type of cell being rendered.
A normal scrollable cell.
The top left fixed cell.
A column header cell.
A selected column header cell.
A column header cell currently under the mouse.
A selected column header cell currently under the mouse.
A row header cell.
A selected row header cell.
A row header cell currently under the mouse.
A selected row header cell currently under the mouse.
A selected normal cell.
The cell that contains the cursor.
Initializes a new instance of a .
Gets a value that determines whether this renderer tracks the selection to paint
highlighted column and row headers.
Gets a value that determines whether this renderer renders hot cells
differently than normal cells.
Hot cells are cells currently under the mouse. If a renderer tracks the mouse,
then it will be called as the mouse moves over the grid.
Gets the foreground color of header cells in the normal state.
Draws a grid cell of any type.
that contains the cell being drawn.
that provides information about the cell being drawn.
This method determines the type of cell being drawn and then calls the
method passing the type of cell to be drawn.
Draws a single grid cell of a specific type.
that contains the cell being drawn.
that provides information about the cell being drawn.
value that determines the type of cell being drawn.
Gets a object used to paint the cell background for a specific cell type.
that contains the cell being drawn.
value that determines the type of cell being drawn.
A that represents the bounds of the cell being drawn.
A object used to render the cell background.
The parameter can be used to create or select complex brushes such as
gradient or tiled image brushes.
Gets a object used to paint the cell borders.
value that determines the type of cell being drawn.
A object used to paint the cell borders.
Represents the base abstract class for Office2007 style renderers.
The easiest way to create a new high-quality renderer is to derive from
this class and provide a constructor that initializes the 25 colors that
define the renderer.
Initializes a new instance of a .
Background color for highlighted cells.
Color of the border around the top left fixed cell.
Color of the background for the top left fixed cell.
First color of the gradient background for the image in the top left fixed cell.
Second color of the gradient background for the image in the top left fixed cell.
First color of the gradient background for column headers.
Second color of the gradient background for column headers.
Color of the border around column headers.
First color of the gradient background for selected column headers.
Second color of the gradient background for selected column headers.
Color of the border around selected column headers.
First color of the gradient background for hot column headers.
Second color of the gradient background for hot column headers.
Color of the border around hot column headers.
First color of the gradient background for selected hot column headers.
Second color of the gradient background for selected hot column headers.
Color of the border around hot selected column headers.
Color of the background for row headers.
Color of the border around row headers.
Color of the background for selected row headers.
Color of the border around selected row headers.
Color of the background for hot row headers.
Color of the border around hot row headers.
Color of the background for hot selected row headers.
Color of the border around selected hot row headers.
Initializes a new instance of a using
a specified color palette.
Array with 25 colors to be used as a palette.
Gets or sets the color used to paint the background of highlighted cells.
Gets a value that determines whether this renderer renders hot cells
differently than normal cells.
Hot cells are cells currently under the mouse. If a renderer tracks the mouse,
then it will be called as the mouse moves over the grid.
Gets a value that determines whether this renderer tracks the selection to paint
highlighted column and row headers.
Gets the background brush for a cell.
that contains the cell.
value that describes the type of cell being rendered.
that defines the cell bounds.
A used to paint the cell.
Gets a pen used to paint the cell borders.
that describes the type of cell being rendered.
A used to paint the cell borders.
Draws a single grid cell of a specific type.
that contains the cell being drawn.
that provides information about the cell being drawn.
value that determines the type of cell being drawn.
that implements the Office2007 Blue visual style.
Initializes a new instance of a .
that implements the Office2007 Silver visual style.
Initializes a new instance of a .
that implements the Office2007 Black visual style.
Initializes a new instance of a .
that implements the Office2010 Blue visual style.
Initializes a new instance of a .
that implements the Office2010 Silver visual style.
Initializes a new instance of a .
that implements the Office2010 Black visual style.
Initializes a new instance of a .
Gets the foreground color of header cells in the normal state.
that implements the System visual style.
Gets a value that determines whether this renderer renders hot cells
differently than normal cells.
Hot cells are cells currently under the mouse. If a renderer tracks the mouse,
then it will be called as the mouse moves over the grid.
Gets a value that determines whether this renderer tracks the selection to paint
highlighted column and row headers.
Draws a single grid cell of a specific type.
that contains the cell being drawn.
that provides information about the cell being drawn.
value that determines the type of cell being drawn.
Static class containing UI strings used by the designer.
Specifies the language to be used for localizing the control.
Localize the control to the language specified by the CurrentUICulture.
Localize the control to Arabic.
Localize the control to Czech.
Localize the control to Danish.
Localize the control to Dutch.
Localize the control to English.
Localize the control to Finnish.
Localize the control to French.
Localize the control to German.
Localize the control to Greek.
Localize the control to Hebrew.
Localize the control to Italian.
Localize the control to Japanese.
Localize the control to Norwegian.
Localize the control to Polish.
Localize the control to Portuguese.
Localize the control to Russian.
Localize the control to Slovak.
Localize the control to Spanish.
Localize the control to Swedish.
Localize the control to Chinese (simplified, PRC and Singapore).
Localize the control to Turkish.
Localize the control to Persian (Farsi).
Localize the control to Korean.
Localize the control to Chinese (traditional, Taiwan, Hong Kong, and Macao).
Localize the control to Hungarian.