1

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.

Albert A-w
  • 317
  • 1
  • 3
  • 7
  • I would rather create a separate custom control, but yeah, you could achieve your intended goal using simple WinForm controls. Check [this](http://stackoverflow.com/questions/542850/how-can-i-insert-an-image-into-a-richtextbox) answer. – KappaG3 Jul 27 '13 at 17:31

2 Answers2

2

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.

Sriram Sakthivel
  • 72,067
  • 7
  • 111
  • 189
0

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.

Ehsan
  • 31,833
  • 6
  • 56
  • 65