Click here to Skip to main content
15,914,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

i have a vb.net based window application.

I added an image to the project resources (myImage.bmp). How can i add this image to my richTextBox on mouse click event (suppose on button click).

Any assistance will be greatly received.

Thanks
Posted

1 solution

Please find this link, this might be very useful csexrichtextbox
And if you want to read images from Project Resource then you can use the code sample below;
System.Drawing.Image tempImage = MyProject.Properties.Resources.myImage;
Clipboard.SetDataObject(tempImage);
DataFormats.Format image = DataFormats.GetFormat(DataFormats.Bitmap);
richTextBox1.Paste(image);
 
Share this answer
 
v2
Comments
Abudreas 29-Mar-11 6:35am    
Good Answer
kals84 29-Mar-11 6:36am    
thanks for the solution.. but i couldn't understand the below line

System.Drawing.Image tempImage = PTUtility.Properties.Resources.Warning;
avigodse 29-Mar-11 7:07am    
Its just sample code, and the PTUtility.Properties.Resources.Warning can be replaced with your project name and resource image name.
i.e. MyProject.Properties.Resources.myImage

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900