• RichTextBox实现鼠标右键(剪切,复制,粘贴)功能


            private static void InitRichTextBoxContextMenu(RichTextBox textBox)

            {

                //创建剪切子菜单

                var cutMenuItem = new System.Windows.Forms.MenuItem("剪切");

                cutMenuItem.Click += (sender, eventArgs) => textBox.Cut();

                //创建复制子菜单

                var copyMenuItem = new System.Windows.Forms.MenuItem("复制");

                copyMenuItem.Click += (sender, eventArgs) => textBox.Copy();

                //创建粘贴子菜单

                var pasteMenuItem = new System.Windows.Forms.MenuItem("粘贴");

                pasteMenuItem.Click += (sender, eventArgs) => textBox.Paste();

                //创建右键菜单并将子菜单加入到右键菜单中

                var contextMenu = new ContextMenu();

                contextMenu.MenuItems.Add(cutMenuItem);

                contextMenu.MenuItems.Add(copyMenuItem);

                contextMenu.MenuItems.Add(pasteMenuItem);

                textBox.ContextMenu = contextMenu;

            }

  • 相关阅读:
    polya定理
    树状数组
    离散数学通路数的矩阵计算法
    高次同余方程求解
    Uva1378
    poj2888
    poj2409&&poj1286
    poj2182
    poj2154
    判断一个字符是否为汉字
  • 原文地址:https://www.cnblogs.com/zhanglei93/p/4762037.html
Copyright © 2020-2023  润新知