Solved

dynamic richtextbox in a panel not showing image

Posted on 2006-11-17
1
274 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now