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

Related posts:

  1. How to Paste the Picture from PictureBox/Clipboard to Rich Text Box
  2. How to Insert Picture without Clearing Clipboard
  3. How to get the currently Selected Text in Rich Text Box
  4. How to check on which word the Mouse hover in Rich Text Box
  5. How to print the contents of Rich Text Box
  6. How to Display the Cursor’s coordinates of a Rich Text Box
  7. How to toggle Word wrap feature on Rich Text Box
  8. How to goto the given line Number in Rich Text Box
  9. How to add Horizonal Scroll Bar to Rich Text Box
  10. How to load a picture in picture box by selecting the picture using Common dialog control.

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

No comments yet.


Leave a comment


No trackbacks yet.