次の方法で共有


DataGrid.ParentRowsLabelStyleChanged イベント

親行のラベル スタイルが変更されると発生します。

Public Event ParentRowsLabelStyleChanged As EventHandler
[C#]
public event EventHandler ParentRowsLabelStyleChanged;
[C++]
public: __event EventHandler* ParentRowsLabelStyleChanged;

[JScript] JScript では、このクラスで定義されているイベントを処理できます。ただし、独自に定義することはできません。

イベント データ

イベント ハンドラが EventArgs 型の引数を受け取りました。

解説

イベント処理の詳細については、「 イベントの利用 」を参照してください。

使用例

 
Private Sub CallParentRowsLabelStyleChanged()
   AddHandler myDataGrid.ParentRowsLabelStyleChanged, AddressOf _
                                        DataGridParentRowsLabelStyleChanged_Clicked
End Sub 'CallParentRowsLabelStyleChanged


' Set the 'ParentRowsLabelStyle' property on click of a button.
Protected Sub ToggleStyle_Clicked(sender As Object, e As EventArgs)
   If myDataGrid.ParentRowsLabelStyle.ToString() = "Both" Then
      myDataGrid.ParentRowsLabelStyle = DataGridParentRowsLabelStyle.TableName
   Else
      myDataGrid.ParentRowsLabelStyle = DataGridParentRowsLabelStyle.Both
   End If
End Sub 'ToggleStyle_Clicked
 
' raise the event when 'ParentRowsLabelStyle' property is changed.
Protected Sub DataGridParentRowsLabelStyleChanged_Clicked(sender As Object, e As EventArgs)
   Dim myMessage As String = "ParentRowsLabelStyleChanged event raised, LabelStyle is : "
   ' Get the state of 'ParentRowsLabelStyle' property.
   Dim myLabelStyle As String = myDataGrid.ParentRowsLabelStyle.ToString()
   myMessage += myLabelStyle
   
   MessageBox.Show(myMessage, "ParentRowsLabelStyle information")
End Sub 'DataGridParentRowsLabelStyleChanged_Clicked


[C#] 
private void CallParentRowsLabelStyleChanged()
{
   myDataGrid.ParentRowsLabelStyleChanged +=
      new EventHandler(DataGridParentRowsLabelStyleChanged_Clicked);
}

// Set the 'ParentRowsLabelStyle' property on click of a button.
protected void ToggleStyle_Clicked(object sender, EventArgs e)
{
   if (myDataGrid.ParentRowsLabelStyle.ToString() == "Both")
      myDataGrid.ParentRowsLabelStyle = DataGridParentRowsLabelStyle.TableName;
   else
      myDataGrid.ParentRowsLabelStyle = DataGridParentRowsLabelStyle.Both;
}

// raise the event when 'ParentRowsLabelStyle' property is changed.
protected void DataGridParentRowsLabelStyleChanged_Clicked(object sender, EventArgs e)
{
   string myMessage = "ParentRowsLabelStyleChanged event raised, LabelStyle is : ";
   // Get the state of 'ParentRowsLabelStyle' property.
   string myLabelStyle = myDataGrid.ParentRowsLabelStyle.ToString();
   myMessage += myLabelStyle;

   MessageBox.Show(myMessage, "ParentRowsLabelStyle information");
}

[C++] 
private:
    void CallParentRowsLabelStyleChanged() {
        myDataGrid->ParentRowsLabelStyleChanged += 
            new EventHandler(this, &MyForm::DataGridParentRowsLabelStyleChanged_Clicked);
    }

    // Set the 'ParentRowsLabelStyle' property on click of a button.
protected:
    void ToggleStyle_Clicked(Object* /*sender*/, EventArgs* /*e*/) {
        if (__box(myDataGrid->ParentRowsLabelStyle)->ToString()->Equals(S"Both"))
            myDataGrid->ParentRowsLabelStyle = DataGridParentRowsLabelStyle::TableName;
        else
            myDataGrid->ParentRowsLabelStyle = DataGridParentRowsLabelStyle::Both;
    }

    // raise the event when 'ParentRowsLabelStyle' property is changed.
    void DataGridParentRowsLabelStyleChanged_Clicked(Object* /*sender*/, EventArgs* /*e*/) {
        String* myMessage = S"ParentRowsLabelStyleChanged event raised, LabelStyle is : ";
        // Get the state of 'ParentRowsLabelStyle' property.
        String* myLabelStyle = __box(myDataGrid->ParentRowsLabelStyle)->ToString();
        myMessage = String::Concat(myMessage, myLabelStyle);

        MessageBox::Show(myMessage, S"ParentRowsLabelStyle information");
    }

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

DataGrid クラス | DataGrid メンバ | System.Windows.Forms 名前空間