Control.ContextMenuChanged 事件

定义

ContextMenu 属性的值更改时发生。

public:
 event EventHandler ^ ContextMenuChanged;
public event EventHandler ContextMenuChanged;
[System.ComponentModel.Browsable(false)]
public event EventHandler ContextMenuChanged;
member this.ContextMenuChanged : EventHandler 
[<System.ComponentModel.Browsable(false)>]
member this.ContextMenuChanged : EventHandler 
Public Custom Event ContextMenuChanged As EventHandler 

事件类型

EventHandler
属性

示例

下面的代码示例在快捷菜单发生更改时显示一条消息。

private:
   void AddContextMenuChangedHandler()
   {
      this->myTextBox->ContextMenuChanged += gcnew EventHandler( this, &MyForm::TextBox_ContextMenuChanged );
   }

   void TextBox_ContextMenuChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      MessageBox::Show( L"Shortcut menu of TextBox is changed." );
   }
private void AddContextMenuChangedHandler()
{
   this.myTextBox.ContextMenuChanged += new EventHandler(TextBox_ContextMenuChanged);
}

private void TextBox_ContextMenuChanged(object sender, EventArgs e)
{
   MessageBox.Show("Shortcut menu of TextBox is changed.");
}
Private Sub AddContextMenuChangedHandler()
   AddHandler Me.myTextBox.ContextMenuChanged, AddressOf TextBox_ContextMenuChanged
End Sub

Private Sub TextBox_ContextMenuChanged(sender As Object, e As EventArgs)
   MessageBox.Show("Shortcut menu of TextBox is changed.")
End Sub

注解

如果 ContextMenu 属性通过编程修改或用户交互更改,则会引发此事件。

有关处理事件的详细信息,请参阅 处理和引发事件

适用于

另请参阅