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.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft