Windows Forms: Insert image into RichTextBox in C#

This post shows you How to Insert an image into a RichTextBox in C# Windows Forms Application.

Dragging RichTextBox, Button from Visual Studio toolbox to your form designer.

c# insert image to richtextbox

Adding a click event handler to the Open button allows you to select an image, then load image in RichTextBox control in C#.

private void btnOpen_Click(object sender, EventArgs e)
{
    using (OpenFileDialog ofd = new OpenFileDialog())
    {
        ofd.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.png; *.bmp)|*.jpg; *.jpeg; *.gif; *.png; *.bmp";
        if (ofd.ShowDialog() == DialogResult.OK)
        {
            Clipboard.SetImage(Image.FromFile(ofd.FileName));
            richTextBox.Paste();
        }
    }
}

We will use OpenFileDialog class to open a dialog allows you to select an image, then copy the image to Clipboard.

Finally, you need to paste to RichTextBox control.