0
Reply

RichTextBox and Images

Harold Clements

Harold Clements

Apr 7 2009 10:59 AM
3.3k

I have a RichTextBox that I wish to copy an image to. I have created a Control that inherits from RichTextBox. It appears that my image is not able to be pasted but I am unsure why? If I break into the code, b has the correct size of the image.

Below is my code:

//Bitmap b = new System.Drawing.Bitmap(global::xxxxxx.xxxxxxx.Properties.Resources.logo2);

Bitmap b = new Bitmap(@"d:\file.bmp");

Clipboard.SetDataObject(b);
DataFormats.Format f = DataFormats.GetFormat(DataFormats.Bitmap);

if (CanPaste(f))
{
   Paste(f);
}
//paste(f);

Any help will be gratefully received.

Kind Regards,
Harold Clements