how to insert image in a textbox

让人想犯罪 __ 提交于 2020-01-01 08:33:18

问题


Is there a way to insert an image in a textbox? I'm working on a chat application. And I want to change the values ":)", ":(" etc. with icon images. But I couldn't find that how can I insert image in a textbox?

Thanks.


回答1:


Use RichTextBox
Insert Plain Text and Images into RichTextBox at Runtime
Inserting images into a RichTextBox control (the OLE way)




回答2:


If you are using RichTextBox for chat than look at Paste method

  Bitmap bitmap = new Bitmap();
  Clipboard.SetDataObject(bitmap );

  DataFormats.Format format= DataFormats.GetFormat (DataFormats.Bitmap);
  richTextBox.Paste(format);


来源:https://stackoverflow.com/questions/6168177/how-to-insert-image-in-a-textbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!