DataGridViewAutoSizeModeEventArgs.PreviousModeAutoSized 속성

정의

DataGridView가 이전에 크기가 자동으로 조정되도록 설정되었는지 여부를 지정하는 값을 가져옵니다.Gets a value specifying whether the DataGridView was previously set to automatically resize.

public:
 property bool PreviousModeAutoSized { bool get(); };
public bool PreviousModeAutoSized { get; }
member this.PreviousModeAutoSized : bool
Public ReadOnly Property PreviousModeAutoSized As Boolean

속성 값

AutoSizeRowsMode 속성이 이전에 DataGridViewAutoSizeRowsMode 이외의 None 값으로 설정되었거나 RowHeadersWidthSizeMode 속성이 이전에 DataGridViewRowHeadersWidthSizeMode 또는 DisableResizing 이외의 EnableResizing 값으로 설정되었으면 true이고, 그렇지 않으면 false입니다.true if the AutoSizeRowsMode property was previously set to any DataGridViewAutoSizeRowsMode value other than None or the RowHeadersWidthSizeMode property was previously set to any DataGridViewRowHeadersWidthSizeMode value other than DisableResizing or EnableResizing; otherwise, false.

예제

다음 코드 예제에서는 합니다 PreviousModeAutoSized 이전 확인할 속성 AutoSizeRowsMode 에 대 한 값을 DataGridView합니다.The following code example uses the PreviousModeAutoSized property to check the previous AutoSizeRowsMode value for a DataGridView. 이 코드 예제에 제공 된 큰 예제의의 일부인 방법: 자동으로 크기를 조정 셀 변경 될 때 콘텐츠는 Windows Forms DataGridView 컨트롤에서합니다.This code example is part of a larger example provided at How to: Automatically Resize Cells When Content Changes in the Windows Forms DataGridView Control.

void WatchRowsModeChanges( Object^ /*sender*/, DataGridViewAutoSizeModeEventArgs^ modeEvent )
{
   Label^ label = dynamic_cast<Label^>(flowLayoutPanel1->Controls[ currentLayoutName ]);
   if ( modeEvent->PreviousModeAutoSized )
   {
      label->Text = String::Format( "changed to a different {0}{1}", label->Name, dataGridView1->AutoSizeRowsMode );
   }
   else
   {
      label->Text = String::Concat( label->Name, dataGridView1->AutoSizeRowsMode );
   }
}


private void WatchRowsModeChanges(object sender,
    DataGridViewAutoSizeModeEventArgs modeEvent)
{
    Label label =
        (Label)flowLayoutPanel1.Controls[currentLayoutName];

    if (modeEvent.PreviousModeAutoSized)
    {
        label.Text = "changed to a different " +
            label.Name +
            dataGridView1.AutoSizeRowsMode.ToString();
    }
    else
    {
        label.Text = label.Name +
            dataGridView1.AutoSizeRowsMode.ToString();
    }
}
Private Sub WatchRowsModeChanges(ByVal sender As Object, _
    ByVal modeEvent As DataGridViewAutoSizeModeEventArgs) _
    Handles DataGridView1.AutoSizeRowsModeChanged

    Dim label As Label = CType(FlowLayoutPanel1.Controls _
        (currentLayoutName), Label)

    If modeEvent.PreviousModeAutoSized Then
        label.Text = "changed to different " & label.Name & _
            DataGridView1.AutoSizeRowsMode.ToString()
    Else
        label.Text = label.Name & _
            DataGridView1.AutoSizeRowsMode.ToString()
    End If
End Sub

설명

DataGridViewAutoSizeModeEventArgs 클래스를 사용 합니다 DataGridView.AutoSizeRowsModeChangedDataGridView.RowHeadersWidthSizeModeChanged 이벤트를이 속성의 이전 상태 관련이 있으므로 합니다 DataGridView.AutoSizeRowsMode 또는 DataGridView.RowHeadersWidthSizeMode 속성The DataGridViewAutoSizeModeEventArgs class is used with the DataGridView.AutoSizeRowsModeChanged and DataGridView.RowHeadersWidthSizeModeChanged events, so this property relates specifically to the previous state of either the DataGridView.AutoSizeRowsMode or DataGridView.RowHeadersWidthSizeMode property

적용 대상

추가 정보