DataGridViewImageCell.Description DataGridViewImageCell.Description DataGridViewImageCell.Description DataGridViewImageCell.Description Property

Definición

Obtiene o establece el texto asociado a la imagen.Gets or sets the text associated with the image.

public:
 property System::String ^ Description { System::String ^ get(); void set(System::String ^ value); };
public string Description { get; set; }
member this.Description : string with get, set
Public Property Description As String

Valor de propiedad

El texto asociado a la imagen mostrada en la celda.The text associated with the image displayed in the cell.

Ejemplos

En el ejemplo de código siguiente se muestra el DataGridViewImageColumn.Description uso de la propiedad, que es similar a esta propiedad.The following code example demonstrates the use of the DataGridViewImageColumn.Description property, which is similar to this property. Este ejemplo forma parte de un ejemplo más grande disponible en cómo: Trabajar con columnas de imagen en el controlDataGridView Windows Forms.This example is part of a larger example available in How to: Work with Image Columns in the Windows Forms DataGridView Control.

void Stretch( Object^ sender, EventArgs^ e )
{
   System::Collections::IEnumerator^ myEnum = dataGridView1->Columns->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      DataGridViewImageColumn^ column = safe_cast<DataGridViewImageColumn^>(myEnum->Current);
      column->ImageLayout = DataGridViewImageCellLayout::Stretch;
      column->Description = L"Stretched";
   }
}

void ZoomToImage( Object^ sender, EventArgs^ e )
{
   System::Collections::IEnumerator^ myEnum1 = dataGridView1->Columns->GetEnumerator();
   while ( myEnum1->MoveNext() )
   {
      DataGridViewImageColumn^ column = safe_cast<DataGridViewImageColumn^>(myEnum1->Current);
      column->ImageLayout = DataGridViewImageCellLayout::Zoom;
      column->Description = L"Zoomed";
   }
}

void NormalImage( Object^ sender, EventArgs^ e )
{
   System::Collections::IEnumerator^ myEnum2 = dataGridView1->Columns->GetEnumerator();
   while ( myEnum2->MoveNext() )
   {
      DataGridViewImageColumn^ column = safe_cast<DataGridViewImageColumn^>(myEnum2->Current);
      column->ImageLayout = DataGridViewImageCellLayout::Normal;
      column->Description = L"Normal";
   }
}


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";
    }
}
Private Sub Stretch(ByVal sender As Object, _
    ByVal e As EventArgs) Handles Button3.Click

    For Each column As DataGridViewImageColumn _
        In dataGridView1.Columns
        column.ImageLayout = DataGridViewImageCellLayout.Stretch
        column.Description = "Stretched image layout"
    Next
End Sub

Private Sub ZoomToImage(ByVal sender As Object, _
    ByVal e As EventArgs) Handles Button4.Click

    For Each column As DataGridViewImageColumn _
        In dataGridView1.Columns
        column.ImageLayout = DataGridViewImageCellLayout.Zoom
        column.Description = "Zoomed image layout"
    Next
End Sub

Private Sub NormalImage(ByVal sender As Object, _
    ByVal e As EventArgs) Handles Button5.Click

    For Each column As DataGridViewImageColumn _
        In dataGridView1.Columns
        column.ImageLayout = DataGridViewImageCellLayout.Normal
        column.Description = "Normal image layout"
    Next
End Sub

Comentarios

Normalmente, se proporciona una descripción de texto para cada celda de imagen.You will typically provide a text description for each image cell. Esta descripción proporciona una alternativa accesible a la imagen.This description provides an accessible alternative to the image. Además, se usa el texto de Descripción cuando el valor de la celda se copia en el portapapeles.Additionally, the description text is used when the cell value is copied onto the Clipboard.

Al establecer Description la propiedad de la columna propietaria también se Description establece la propiedad de todas las celdas de la columna.Setting the Description property of the owning column also sets the Description property of every cell in the column. Para reemplazar el valor especificado para celdas individuales, establezca los valores de la celda después de establecer el valor de la columna.To override the specified value for individual cells, set the cell values after you set the column value.

Se aplica a

Consulte también: