Click here to Skip to main content
15,902,275 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Have TextBox In My Application That I Want to Add Image To This , Some Times

Like Microsoft Office Word I am Going To Have Both Text And Image

Is it Possible ?

If It possible How?

Thanks.
Posted
Comments
LanFanNinja 9-Nov-11 17:35pm    
Sorry I just noticed the link I gave you was for silverlight. Hope that it worked ok for you. Just in case it did not I have added some code that works (I tested it before adding) to give you and example of how this might be done. So if you see this recheck my solution.

1 solution

Use a RichTextBox control instead. Check this out http://msdn.microsoft.com/en-us/library/ee681613%28v=vs.95%29.aspx#inline_images_or_other_elements[^]

ok so I just noticed the first link I added was for silverlight? I was tired sorry.

So I thought I would add some example code

C#
BitmapImage bitmap = new BitmapImage(new Uri(@"testImg.png", UriKind.RelativeOrAbsolute));
Image image = new Image();
image.Source = bitmap;
image.Width = 32;
image.Height = 32;
InlineUIContainer container = new InlineUIContainer(image);
Paragraph paragraph = new Paragraph(container);
paragraph.Inlines.Add("This is a image and some text!");
richTextBox1.Document.Blocks.Add(paragraph);
 
Share this answer
 
v4

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