Table of Contents

Property DefaultMenu

Namespace
Alternet.Editor
Assembly
Alternet.Editor.v9.dll

DefaultMenu

Gets or sets default context menu for the editor control.

[Browsable(false)]
public ContextMenuStrip DefaultMenu { get; set; }

Property Value

ContextMenuStrip

Examples

Here is how to use a DefaultMenu in the C# code:

public partial class Form1 : Form
{
    private void Form1_Load(object sender, EventArgs e)
    {
        var syntaxEdit1 = new Alternet.Editor.SyntaxEdit(this.components);
        syntaxEdit1.UseDefaultMenu = true;
        syntaxEdit1.DefaultMenu.Items.Add(new ToolStripMenuItem("Custom Action", null, new EventHandler(DoCustomAction)));
    }

    protected void DoCustomAction(object sender, System.EventArgs e)
    {
        System.Windows.Forms.MessageBox.Show("This is a custom action");
    }
}

Here is how to use a DefaultMenu in the Visual Basic code:

Partial Public Class Form1
    Inherits Form

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim syntaxEdit1 = New Alternet.Editor.SyntaxEdit(Me.components)
        syntaxEdit1.UseDefaultMenu = True
        syntaxEdit1.DefaultMenu.Items.Add(New ToolStripMenuItem("Custom Action", Nothing, New EventHandler(AddressOf DoCustomAction)))
    End Sub

    Protected Sub DoCustomAction(ByVal sender As Object, ByVal e As System.EventArgs)
        System.Windows.Forms.MessageBox.Show("This is a custom action")
    End Sub
End Class

Remarks

SyntaxEdit control uses its context menu with text editing actions, such as cut, copy, or paste, unless UseDefaultMenu is set to false.

You can extend DefaultMenu with your own menu items, or set a different ContextMenuStrip or ContextMenuStrip to provide a different context menu.