System.Windows.Forms.DataGridViewImageColumn Class

Hosts a collection of System.Windows.Forms.DataGridViewImageCell objects.

See Also: DataGridViewImageColumn Members

Syntax

[System.Drawing.ToolboxBitmap("")]
public class DataGridViewImageColumn : DataGridViewColumn

Remarks

The System.Windows.Forms.DataGridViewImageColumn class is a specialized type of the System.Windows.Forms.DataGridViewColumn class used to logically host cells that display images. A System.Windows.Forms.DataGridViewImageColumn has an associated System.Windows.Forms.DataGridViewImageCell in every System.Windows.Forms.DataGridViewRow that intersects it. Each cell is capable of containing an System.Drawing.Image or an System.Drawing.Icon, depending on the value of the DataGridViewImageCell.ValueIsIcon property. Displaying icons is useful to accommodate images with transparency.

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 DataGridViewImageColumn.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 DataGridView.AllowUserToAddRows property value is true, you must also either explicitly set the cell value to null in a handler for the control DataGridView.RowsAdded event or set the column DataGridViewImageColumn.CellTemplate property to an instance of a System.Windows.Forms.DataGridViewImageCell-derived type with an overridden DataGridViewImageCell.DefaultNewRowValue property that returns null.

The default sort mode for this column type is DataGridViewColumnSortMode.NotSortable.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0