DataGridViewImageColumn.Description Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém ou define uma cadeia que descreve a imagem da coluna.
public:
property System::String ^ Description { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Browsable(true)]
public string Description { get; set; }
[<System.ComponentModel.Browsable(true)>]
member this.Description : string with get, set
Public Property Description As String
Valor de Propriedade
A descrição textual da imagem da coluna. A predefinição é Empty.
- Atributos
Exceções
O valor da CellTemplate propriedade é null.
Exemplos
O seguinte exemplo de código demonstra como usar a Description propriedade para refletir o layout da imagem. Este exemplo faz parte de um exemplo maior disponível em Como trabalhar: Trabalhar com Colunas de Imagem no Windows Forms Controlo DataGridView.
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
Observações
Pode usar a Description propriedade para descrever a imagem fornecida pela Image ou Icon propriedade. Esta descrição oferece uma alternativa acessível à imagem. Além disso, o texto de descrição é usado quando o valor da célula é copiado para a Área de Transferências.
Obter ou definir esta propriedade obtém ou define a Description propriedade do objeto devolvido pela CellTemplate propriedade. Definir esta propriedade também define a Description propriedade de cada célula da coluna. Para sobrescrever o valor especificado para células individuais, defina os valores das células depois de definir o valor da coluna.