代码如下:

       //获取RichTextBox控件中鼠标焦点的索引位置 
            int startPosition = this.richTextBox1.SelectionStart;
            //从鼠标焦点处开始选中几个字符
            this.richTextBox1.SelectionLength = 2;
            //清空剪切板,防止里面之前有内容
            Clipboard.Clear();
            //给剪切板设置图片对象
            Bitmap bmp = new Bitmap(@"Images\editredo.png");
            Clipboard.SetImage(bmp);
            //将图片粘贴到鼠标焦点位置(由于有选中2个字符,所以那2个字符会被图片覆盖)
            richTextBox1.Paste();
            Clipboard.Clear();

 

相关文章:

  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2022-02-28
  • 2022-02-01
猜你喜欢
  • 2021-08-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
相关资源
相似解决方案