Reputation: 407
i am making a messenger application something like windows live messenger. when a user want to send some data or attachments to the other end user, he can upload a picture for example, in my application the other end receives the picture by a new form popping out on the screen saying "you have received an attachment/picture" open/close ... etc. my question is, is it possible to insert the picture box the the textbox that shows chat texts? it is like putting it on a new line between the other texts, that are showing in the logs.
Upvotes: 1
Views: 872
Reputation: 73482
You can't add images to TextBox
control, You have to use RichTextBox
but still problem persists. You have to use Clipboard
in order to Add Image to RichTextBox
.
Clipboard.SetImage(image);
richTextBox.SelectionStart = index;//where you want image
richTextBox.Paste();
Above code will help you to add Image to RichTextBox
but then there's no easy way to manipulate over it.
Alternatively you can take a look at this article, this looks promising and I've used it a bit ago.
Hope this helps.
Upvotes: 2
Reputation: 32681
You need to use RichTextBox for this purpose. That will serve your purpose really well. Textbox is a simple control used for text only and doesn't has such features.
Upvotes: 0