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

Related posts:

  1. How to insert a picture into Rich Text box
  2. How to Insert Picture without Clearing Clipboard
  3. How to Copy and Paste the Picture
  4. How to check on which word the Mouse hover in Rich Text Box
  5. How to Display the Cursor’s coordinates of a Rich Text Box
  6. How to get the currently Selected Text in Rich Text Box
  7. How to goto the given line Number in Rich Text Box
  8. How to toggle Word wrap feature on Rich Text Box
  9. How to select portion of Picture and paste it to Picture Box
  10. How to add Picture to PictureBox at Run-Time

Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.