ImageColumn
Hosts a collection of DataGridViewImageCell objects.
The DataGridViewImageColumn class is a specialized type of the DataGridViewColumn class used to logically host cells that display images. A DataGridViewImageColumn has an associated DataGridViewImageCell in every DataGridViewRow that intersects it. Each cell is capable of containing an Image or an Icon.
By default, empty cells display a default error graphic. To prevent this graphic from appearing for cell values equal to null
or DBNull.Value
, set the DataGridViewCellStyle.NullValue property of the cell style object returned by the DefaultCellStyle property to null
before adding rows to the control. This does not affect the row for new records, however. To prevent the error graphic from appearing in the row for new records when the control AllowUserToAddRows property value is true
, you must also either explicitly set the cell value to null
in a handler for the control RowsAdded event or set the column CellTemplate property to an instance of a DataGridViewImageCell-derived type with an overridden DefaultNewRowValue property that returns null
.
The default sort mode for this column type is NotSortable
.
For a full list of properties, methods and events see the API documentation.
Last updated