• HOME
  • PRODUCTS
  • DEMOS
  • BUY
  • BLOG
  • FORUM
  • DOCUMENTATION
  • ABOUT
  • FREE EVALUATION
Search Results for

    Show / Hide Table of Contents

    DefaultMenu Property

    DefaultMenu

    Gets or sets default context menu for the editor control.

    Declaration
    [Browsable(false)]
    public ContextMenuStrip DefaultMenu { get; set; }
    Property Value
    Type Description
    ContextMenuStrip
    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.

    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
    
    In This Article
    Back to top Copyright AlterNET Software Download PDF