相关疑难解决方法(0)

在富文本框中的光标位置插入图像

我知道有这样的各种问题,但我问,因为我无法理解所有答案.我有RichTextBox,我希望用户能够在当前光标位置插入图像.

我尝试使用Clipboard设置图像,然后将其粘贴到富文本框中.这有效,但我已被告知其不良做法,因为它在不通知用户的情况下更改cliboard中的数据.

这就是我尝试过的

    private bool CheckIfImage(string filename)
    {
        if (filename.EndsWith(".jpeg")) { return true; }
        else if (filename.EndsWith(".jpg")) { return true; }
        else if (filename.EndsWith(".png")) { return true; }
        else if (filename.EndsWith(".ico")) { return true; }
        else if (filename.EndsWith(".gif")) { return true; }
        else if (filename.EndsWith(".bmp")) { return true; }
        else if (filename.EndsWith(".emp")) { return true; }
        else if (filename.EndsWith(".wmf")) { return true; }
        else if (filename.EndsWith(".tiff")) { return true; }
        else { return false; }
    } …
Run Code Online (Sandbox Code Playgroud)

c# image richtextbox winforms

6
推荐指数
1
解决办法
9159
查看次数

标签 统计

c# ×1

image ×1

richtextbox ×1

winforms ×1