Solved

dynamic richtextbox in a panel not showing image

Posted on 2006-11-17
1
280 Views
Last Modified: 2010-05-18
I am dynamically adding RichTextBoxes to a panel dynamically. In each RichTextBox I am embedding an image as follows



string iconName = "MyIconName.gif";
System.IO.Stream strm  = null;
strm = this.GetType().Assembly.GetManifestResourceStream(iconName);
System.Drawing.Image image  = Image.FromStream(strm);

RichTextBox r = new RitchTextBox();
Clipboard.SetDataObject(image);
DataFormats.Format myFormat = DataFormats.GetFormat (DataFormats.Bitmap);
r.Paste(myFormat);


The image does not show up but if I apply the same code to a RichTextBox that is not added dynamically to the panel, then it shows up fine.... What do I need to do in order to have the embedded image show up?
0
Comment
Question by:dotnet22
1 Comment
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 17970502
RichTextBox r = new RitchTextBox();

This is not enough to create control. You need to add it to Controls collection of parent control and then show it. Maybe after this r.Paste will work.
0

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question