다음을 통해 공유


DataGridViewImageColumn.Description 속성

정의

열의 이미지를 설명하는 문자열을 가져오거나 설정합니다.

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

속성 값

열 이미지에 대한 텍스트 설명입니다. 기본값은 Empty입니다.

특성

예외

속성 값은 CellTemplate .입니다 null.

예제

다음 코드 예제에서는 이미지 레이아웃을 Description 반영 하는 속성을 사용 하는 방법을 보여 줍니다. 이 예제는 방법: Windows Forms 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

설명

속성을 사용하여 Description 또는 Icon 속성에서 제공하는 Image 이미지를 설명할 수 있습니다. 이 설명은 이미지에 대한 접근성 있는 대안을 제공합니다. 또한 셀 값이 클립보드에 복사될 때 설명 텍스트가 사용됩니다.

이 속성을 가져오거나 설정하면 속성에서 반환된 Description 개체의 속성이 가져오거나 설정됩니다 CellTemplate . 이 속성을 설정하면 열에 Description 있는 모든 셀의 속성도 설정됩니다. 개별 셀에 대해 지정된 값을 재정의하려면 열 값을 설정한 후 셀 값을 설정합니다.

적용 대상

추가 정보