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

How did you admit the your control works well? maybe the problem in your control.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.