CodeItBetter Programming Another VB Programming Blog

How to insert a picture into Rich Text box

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'Controls - How to insert a picture into Rich Text box
Option Explicit
 
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
    ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const WM_PASTE = &H302
 
'Add a Rich Textbox, a button and an image control of the image you want to insert.
Private Sub Command1_Click()
    'Clear the contents of rtb1
    rtb1.Text = ""
    'Clear the clipboard
    Clipboard.Clear
    'Populate the clipboard with image 1's picture
    Clipboard.SetData Image1.Picture
    'Add it to rtb1
    SendMessage rtb1.hwnd, WM_PASTE, 0, 0
End Sub
Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.