DataGridView.AutoSizeRowsModeChanged DataGridView.AutoSizeRowsModeChanged DataGridView.AutoSizeRowsModeChanged DataGridView.AutoSizeRowsModeChanged Event

정의

DataGridViewAutoSizeRowsMode 속성 값이 변경되면 발생합니다.Occurs when the value of the DataGridViewAutoSizeRowsMode property changes.

public:
 event System::Windows::Forms::DataGridViewAutoSizeModeEventHandler ^ AutoSizeRowsModeChanged;
public event System.Windows.Forms.DataGridViewAutoSizeModeEventHandler AutoSizeRowsModeChanged;
member this.AutoSizeRowsModeChanged : System.Windows.Forms.DataGridViewAutoSizeModeEventHandler 
Public Custom Event AutoSizeRowsModeChanged As DataGridViewAutoSizeModeEventHandler 

예제

다음 코드 예제에서는이 이벤트의 사용을 보여 줍니다.The following code example illustrates the use of this event. 이 예제는 다음 방법에서 사용할 수 있는 더 큰 예제의 일부입니다. Windows Forms DataGridView 컨트롤의 내용이 변경 되 면 셀의 크기를 자동으로 조정 합니다.This example is part of a larger example available in 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

설명

이벤트를 처리 하는 방법에 대 한 자세한 내용은 참조 하세요. 이벤트 처리 및 발생합니다.For more information about how to handle events, see Handling and Raising Events.

적용 대상

추가 정보