winform 中向richtextbox插入图片

richtextbox可以当容器使用,
PictureBox pb = new PictureBox();
pb.Image = (new Icon("App.ico")).ToBitmap();
this.richTextBox1.Controls.Add(pb);
 

///////////////////////////////////
 
public void InsertImage()
{
bool b = rtb1.ReadOnly;
Image img = Image.FromFile("sss.bmp");
Clipboard.SetDataObject(img);
rtb1.ReadOnly = false;
rtb1.Paste(DataFormats.GetFormat(DataFormats.Bitmap));
rtb1.ReadOnly = b;
}
 
richtextbox中插入图片

你可能感兴趣的:(WinForm)