다음을 통해 공유


DataGrid.ReadOnlyChanged 이벤트

정의

ReadOnly 속성 값이 변경되면 발생합니다.

public:
 event EventHandler ^ ReadOnlyChanged;
public event EventHandler ReadOnlyChanged;
member this.ReadOnlyChanged : EventHandler 
Public Custom Event ReadOnlyChanged As EventHandler 

이벤트 유형

예제

다음 코드 예제에서는이 멤버를 사용 하는 방법을 보여 줍니다.

   // Attach to event handler.
private:
   void AttachReadOnlyChanged()
   {
      this->myDataGrid->ReadOnlyChanged += gcnew EventHandler( this, &MyDataGridClass_FlatMode_ReadOnly::myDataGrid_ReadOnlyChanged );
   }

   // Check if the 'ReadOnly' property is changed.
   void myDataGrid_ReadOnlyChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      String^ strMessage = "false";
      if ( myDataGrid->ReadOnly == true )
            strMessage = "true";

      MessageBox::Show( "Read only changed to " + strMessage, "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation );
   }

   // Toggle the 'ReadOnly' property.
   void button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      if ( myDataGrid->ReadOnly == true )
            myDataGrid->ReadOnly = false;
      else
            myDataGrid->ReadOnly = true;
   }
// Attach to event handler.
private void AttachReadOnlyChanged()
{
   this.myDataGrid.ReadOnlyChanged += new EventHandler(this.myDataGrid_ReadOnlyChanged);
}
// Check if the 'ReadOnly' property is changed.
private void myDataGrid_ReadOnlyChanged(object sender, EventArgs e)
{   
   string strMessage = "false";
   if(myDataGrid.ReadOnly == true)
      strMessage = "true";

   MessageBox.Show("Read only changed to "+strMessage,
      "Message",   MessageBoxButtons.OK,
      MessageBoxIcon.Exclamation);         
}
// Toggle the 'ReadOnly' property.
private void button2_Click(object sender, EventArgs e)
{
   if(myDataGrid.ReadOnly == true)
      myDataGrid.ReadOnly = false;
   else
      myDataGrid.ReadOnly = true;
}
' Check if the 'ReadOnly' property is changed.
Private Sub myDataGrid_ReadOnlyChanged(ByVal sender As Object, ByVal e As EventArgs) Handles myDataGrid.ReadOnlyChanged
    Dim strMessage As String = "false"
    If myDataGrid.ReadOnly = True Then
        strMessage = "true"
    End If
    MessageBox.Show("Read only changed to " + strMessage, "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Sub

' Toggle the 'ReadOnly' property.
Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button2.Click
    If myDataGrid.ReadOnly = True Then
        myDataGrid.ReadOnly = False
    Else
        myDataGrid.ReadOnly = True
    End If
End Sub

적용 대상

추가 정보