DataGridColumnStyle.ReadOnlyChanged イベント
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Public Event ReadOnlyChanged As EventHandler
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)


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

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- DataGridColumnStyle.ReadOnlyChanged イベントのページへのリンク