DataGridViewImageColumn.ImageLayout 속성

정의

이 열의 셀에 있는 이미지 레이아웃을 가져오거나 설정합니다.

public:
 property System::Windows::Forms::DataGridViewImageCellLayout ImageLayout { System::Windows::Forms::DataGridViewImageCellLayout get(); void set(System::Windows::Forms::DataGridViewImageCellLayout value); };
public System.Windows.Forms.DataGridViewImageCellLayout ImageLayout { get; set; }
member this.ImageLayout : System.Windows.Forms.DataGridViewImageCellLayout with get, set
Public Property ImageLayout As DataGridViewImageCellLayout

속성 값

셀 레이아웃을 지정하는 DataGridViewImageCellLayout입니다. 기본값은 Normal입니다.

예외

CellTemplate 속성의 값이 null인 경우

예제

다음 코드 예제에서는 셀에 맞게 이미지를 확대/축소하는 방법을 보여 줍니다. 이 예제는에서 사용할 수 있는 보다 큰 예제의 일부 방법: 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

설명

거사 설정 받기 또는이 속성을 설정 합니다 ImageLayout 반환 하는 개체의 속성을 CellTemplate 속성입니다. 이 속성을 설정 집합을 ImageLayout 속성 새로 고침 및 열에 있는 모든 셀의 열을 표시 합니다. 열 값을 설정 하면 개별 셀에 대해 지정된 된 값을 재정의 하려면 셀 값을 설정 합니다.

적용 대상

추가 정보