vb: how to add picture to RichTextBox?
This site provides users with the information about vb, visual basic, vb6, add picture to richtextbox, how to add picture to richtextbox, add image to rich textbox, how to add image to rich text box, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to add picture to RichTextBox?
The following are the instructions for how to add image to RichTextBox:
1. In declare section, you need to add the following:
2. Create a Sub and add the following:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"_
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)_
Private Const WM_PASTE = &H302
Private Sub Command1_Click()
' Copy the picture into the clipboard.
' Paste the picture into the RichTextBox.
myString = RichTextBox1.Text
RichTextBox1.Text = vbCrLf & vbCrLf & myString
SendMessage RichTextBox1.hwnd, WM_PASTE, 0, 0