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:
- How to Paste the Picture from PictureBox/Clipboard to Rich Text Box
- How to Insert Picture without Clearing Clipboard
- How to get the currently Selected Text in Rich Text Box
- How to check on which word the Mouse hover in Rich Text Box
- How to print the contents of Rich Text Box
- How to Display the Cursor’s coordinates of a Rich Text Box
- How to toggle Word wrap feature on Rich Text Box
- How to goto the given line Number in Rich Text Box
- How to add Horizonal Scroll Bar to Rich Text Box
- How to load a picture in picture box by selecting the picture using Common dialog control.