Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Tritt ein, wenn sich der ReadOnly-Eigenschaftenwert ändert.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
'Declaration
Public Event ReadOnlyChanged As EventHandler
'Usage
Dim instance As DataGridColumnStyle
Dim handler As EventHandler
AddHandler instance.ReadOnlyChanged, handler
public event EventHandler ReadOnlyChanged
public:
event EventHandler^ ReadOnlyChanged {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
/** @event */
public void add_ReadOnlyChanged (EventHandler value)
/** @event */
public void remove_ReadOnlyChanged (EventHandler value)
JScript unterstützt die Verwendung von Ereignissen, aber nicht die Deklaration von neuen Ereignissen.
Hinweise
Weitere Informationen zum Behandeln von Ereignissen finden Sie unter Behandeln von Ereignissen.
Beispiel
Private Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
If myButton.Text = "Make column read/write" Then
myDataGridColumnStyle.ReadOnly = False
myButton.Text = "Make column read only"
Else
myDataGridColumnStyle.ReadOnly = True
myButton.Text = "Make column read/write"
End If
End Sub 'Button_Click
Private Sub AddCustomDataTableStyle()
myDataGridTableStyle = New DataGridTableStyle()
myDataGridTableStyle.MappingName = "Customers"
myDataGridColumnStyle = New DataGridTextBoxColumn()
myDataGridColumnStyle.MappingName = "CustName"
' Add EventHandler function for readonlychanged event.
AddHandler myDataGridColumnStyle.ReadOnlyChanged, AddressOf myDataGridColumnStyle_ReadOnlyChanged
myDataGridColumnStyle.HeaderText = "Customer"
myDataGridTableStyle.GridColumnStyles.Add(myDataGridColumnStyle)
' Add the 'DataGridTableStyle' instance to the 'DataGrid'.
myDataGrid.TableStyles.Add(myDataGridTableStyle)
End Sub 'AddCustomDataTableStyle
Private Sub myDataGridColumnStyle_ReadOnlyChanged(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show("'Readonly' property is changed")
End Sub 'myDataGridColumnStyle_ReadOnlyChanged
private void Button_Click(Object sender, EventArgs e)
{
if (myButton.Text == "Make column read/write")
{
myDataGridColumnStyle.ReadOnly = false;
myButton.Text = "Make column read only";
}
else
{
myDataGridColumnStyle.ReadOnly = true;
myButton.Text = "Make column read/write";
}
}
private void AddCustomDataTableStyle()
{
myDataGridTableStyle = new DataGridTableStyle();
myDataGridTableStyle.MappingName = "Customers";
myDataGridColumnStyle = new DataGridTextBoxColumn();
myDataGridColumnStyle.MappingName= "CustName";
// Add EventHandler function for readonlychanged event.
myDataGridColumnStyle.ReadOnlyChanged += new EventHandler(myDataGridColumnStyle_ReadOnlyChanged);
myDataGridColumnStyle.HeaderText = "Customer";
myDataGridTableStyle.GridColumnStyles.Add(myDataGridColumnStyle);
// Add the 'DataGridTableStyle' instance to the 'DataGrid'.
myDataGrid.TableStyles.Add(myDataGridTableStyle);
}
private void myDataGridColumnStyle_ReadOnlyChanged(Object sender, EventArgs e)
{
MessageBox.Show("'Readonly' property is changed");
}
private:
void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
{
if ( myButton->Text->Equals( "Make column read/write" ) )
{
myDataGridColumnStyle->ReadOnly = false;
myButton->Text = "Make column read only";
}
else
{
myDataGridColumnStyle->ReadOnly = true;
myButton->Text = "Make column read/write";
}
}
void AddCustomDataTableStyle()
{
myDataGridTableStyle = gcnew DataGridTableStyle;
myDataGridTableStyle->MappingName = "Customers";
myDataGridColumnStyle = gcnew DataGridTextBoxColumn;
myDataGridColumnStyle->MappingName = "CustName";
// Add EventHandler function for readonlychanged event.
myDataGridColumnStyle->ReadOnlyChanged += gcnew EventHandler( this, &MyForm1::myDataGridColumnStyle_ReadOnlyChanged );
myDataGridColumnStyle->HeaderText = "Customer";
myDataGridTableStyle->GridColumnStyles->Add( myDataGridColumnStyle );
// Add the 'DataGridTableStyle' instance to the 'DataGrid'.
myDataGrid->TableStyles->Add( myDataGridTableStyle );
}
void myDataGridColumnStyle_ReadOnlyChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
{
MessageBox::Show( "'Readonly' property is changed" );
}
void Button_Click(Object sender, EventArgs e)
{
if (myButton.get_Text().Equals("Make column read/write")) {
myDataGridColumnStyle.set_ReadOnly(false);
myButton.set_Text("Make column read only");
}
else {
myDataGridColumnStyle.set_ReadOnly(true);
myButton.set_Text("Make column read/write");
}
} //Button_Click
private void AddCustomDataTableStyle()
{
myDataGridTableStyle = new DataGridTableStyle();
myDataGridTableStyle.set_MappingName("Customers");
myDataGridColumnStyle = new DataGridTextBoxColumn();
myDataGridColumnStyle.set_MappingName("CustName");
// Add EventHandler function for readonlychanged event.
myDataGridColumnStyle.add_ReadOnlyChanged(new EventHandler(
myDataGridColumnStyle_ReadOnlyChanged));
myDataGridColumnStyle.set_HeaderText("Customer");
myDataGridTableStyle.get_GridColumnStyles().Add(myDataGridColumnStyle);
// Add the 'DataGridTableStyle' instance to the 'DataGrid'.
myDataGrid.get_TableStyles().Add(myDataGridTableStyle);
} //AddCustomDataTableStyle
void myDataGridColumnStyle_ReadOnlyChanged(Object sender, EventArgs e)
{
MessageBox.Show("'Readonly' property is changed");
} //myDataGridColumnStyle_ReadOnlyChanged
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
DataGridColumnStyle-Klasse
DataGridColumnStyle-Member
System.Windows.Forms-Namespace