CodeItBetter Programming Another VB Programming Blog

How to Paste the Picture from PictureBox/Clipboard to Rich Text Box

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'Controls - How to Paste the Picture from PictureBox/Clipboard to Rich Text Box

Option Explicit
 
'Add a Command Button, a Rich Text Box and a Picture Box to your form and Add a picture to the Picture Box.
'When you click the button,  the picture box's picture will be copied to the clipboard,
'then it will be pasted to the Rich Text Box.

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
 
Private Sub Command1_Click()
    Clipboard.Clear
    Clipboard.SetData Picture1.Picture
    SendMessage RichTextBox1.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.