how to get icon in richtextbox......

  • Thread starter Thread starter Supra
  • Start date Start date
Supra said:
how do i get icon in richtextbox's control in vb.net similar to msn chat?

The simplest solution is to utilize the clipboard. However, this method has
the disadvantage of clearing the clipboard's content:

\\\
Dim img As Image = Image.FromFile("C:\camera.bmp")
Clipboard.SetDataObject(img)
RichTextBox1.Paste()
///

Preserving the clipboard content:

\\\
Dim ClipboardContent As Image = _
DirectCast( _
Clipboard.GetDataObject().GetData(DataFormats.Bitmap), _
Image _
)
Dim img As Image = Image.FromFile("C:\WINDOWS\Angler.bmp")
Clipboard.SetDataObject(img)
RichTextBox1.Paste()
If Not ClipboardContent Is Nothing Then
Clipboard.SetDataObject(ClipboardContent, True)
ClipboardContent.Dispose()
End If
img.Dispose()
///

More advanced solution:

Insert Plain Text and Images into RichTextBox at Runtime
<URL:http://www.codeproject.com/cs/miscctrl/CsExRichTextBox.asp>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top