Control.ContextMenuChanged Control.ContextMenuChanged Control.ContextMenuChanged Control.ContextMenuChanged Event

定义

ContextMenu 属性的值更改时发生。Occurs when the value of the ContextMenu property changes.

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

示例

下面的代码示例在快捷菜单发生更改时显示一条消息。The following code example displays a message when a change occurs to the shortcut menu.

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更改了属性,则会引发此事件。This event is raised if the ContextMenu property is changed by either a programmatic modification or user interaction.

有关处理事件的详细信息, 请参阅处理和引发事件For more information about handling events, see Handling and Raising Events.

适用于

另请参阅