Exemple #1
0
        private static string GuiRetrieveDataField()
        {
            ClipboardUtil.Clear();
            Application.DoEvents();

            GuiSendKeysPrc(@"^c");

            try
            {
                if (ClipboardUtil.ContainsText())
                {
                    return(ClipboardUtil.GetText() ?? string.Empty);
                }
            }
            catch (Exception) { Debug.Assert(false); }            // Opened by other process

            return(string.Empty);
        }
        // ========================================
        // method
        // ========================================
        public override ContextMenuStrip GetContextMenu(MouseEventArgs e)
        {
            if (_cut == null)
            {
                InitItems();
            }
            _ContextMenu.Items.Clear();

            _ContextMenu.Items.Add(_cut);
            _ContextMenu.Items.Add(_copy);

            /// clipboard
            var containsBlocksAndInlines = ClipboardUtil.ContainsBlocksAndInlines();
            var containsText             = ClipboardUtil.ContainsText();

            if (containsBlocksAndInlines)
            {
                _ContextMenu.Items.Add(_pasteInlines);
            }

            if (!containsBlocksAndInlines && containsText)
            {
                _ContextMenu.Items.Add(_pasteText);
            }
            if (containsText)
            {
                _ContextMenu.Items.Add(_pasteTextInBlock);
            }

            _ContextMenu.Items.Add(_delete);

            _ContextMenu.Items.Add(_separator1);

            _ContextMenu.Items.Add(_selectParagraph);
            _ContextMenu.Items.Add(_selectAll);

            _cut.Enabled    = !_owner.Selection.IsEmpty;
            _copy.Enabled   = !_owner.Selection.IsEmpty;
            _delete.Enabled = !_owner.Selection.IsEmpty;

            return(_ContextMenu);
        }