Esempio n. 1
0
 private void Editor_ContextMenuRequested(object sender, ContextMenuRequestEventArgs e)
 {
     if (this.editor.ContextMenu == null)
     {
         this.editor.ContextMenu = this.CreateContextMenuSkeleton();
     }
     this.UpdateContextMenu();
 }
        private void syntaxEditor1_ContextMenuRequested(object sender, ContextMenuRequestEventArgs e)
        {
            int lineNumber = syntaxEditorExternal.Views[0].LocationToPosition(e.MenuLocation, LocationToPositionAlgorithm.Block).Line;

            if (syntaxEditorExternal.Document.Lines[lineNumber].BackColor != Color.White &&
                syntaxEditorExternal.Document.Lines[lineNumber].BackColor != Color.Empty)
            {
                SelectLines(e.MenuLocation);
                syntaxEditorExternal.DefaultContextMenuEnabled = false;
                contextMenuStrip1.Show(syntaxEditorExternal, e.MenuLocation);
            }
            else
            {
                DeselectLines();
                syntaxEditorExternal.DefaultContextMenuEnabled = false;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Occurs when a context menu should be displayed.
        /// </summary>
        private void EditorContextMenuRequested(object sender, ContextMenuRequestEventArgs e)
        {
            var ht = HitTest(e.MouseLocation);
            if (ht == null)
                return;
            
            var handler = ShowContextMenu;
            if (handler == null)
                return;

            var lineIndex = (ht.DocumentLine != null) ? ht.DocumentLine.Index + 1 : -1;
            var arg = new ShowContextMenuEventArg(this, e.MouseLocation, e.MenuLocation, lineIndex);
            handler(this, arg);
        }
Esempio n. 4
0
 private void EditorContextMenuRequested(object sender, ContextMenuRequestEventArgs e)
 {
     SyntaxEditorHitTestResult ht = HitTest(e.MouseLocation);
     if (ht == null)
         return;
     EventHandler<ShowContextMenuEventArg> handler = ShowContextMenu;
     if (handler != null)
     {
         int lineIndex = (ht.DocumentLine != null) ? ht.DocumentLine.Index + 1 : -1;
         handler(this, new ShowContextMenuEventArg(e.MouseLocation, e.MenuLocation, lineIndex));
     }
 }