Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DataGridViewImageCell.Description Property

Gets or sets the text associated with the image.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public string Description { get; set; }

Property Value

Type: System.String
The text associated with the image displayed in the cell.

You will typically provide a text description for each image cell. This description provides an accessible alternative to the image. Additionally, the description text is used when the cell value is copied onto the Clipboard.

Setting the Description property of the owning column also sets the Description property of every cell in the column. To override the specified value for individual cells, set the cell values after you set the column value.

The following code example demonstrates the use of the DataGridViewImageColumn.Description property, which is similar to this property. This example is part of a larger example available in How to: Work with Image Columns in the Windows Forms DataGridView Control.

private void Stretch(object sender, EventArgs e)
{
    foreach (DataGridViewImageColumn column in
        dataGridView1.Columns)
    {
        column.ImageLayout = DataGridViewImageCellLayout.Stretch;
        column.Description = "Stretched";
    }
}

private void ZoomToImage(object sender, EventArgs e)
{

    foreach (DataGridViewImageColumn column in
        dataGridView1.Columns)
    {
        column.ImageLayout = DataGridViewImageCellLayout.Zoom;
        column.Description = "Zoomed";
    }
}

private void NormalImage(object sender, EventArgs e)
{

    foreach (DataGridViewImageColumn column in
        dataGridView1.Columns)
    {
        column.ImageLayout = DataGridViewImageCellLayout.Normal;
        column.Description = "Normal";
    }
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft