chitika

Sunday, September 11, 2011

vb: how to add picture to RichTextBox?

This site provides users with the information about vb, visual basic, vb6, add picture to richtextbox, how to add picture to richtextbox, add image to rich textbox, how to add image to rich text box, and more.

If you think that this site is helpful, please recommend your friends to visit our site.


How to add picture to RichTextBox?

The following are the instructions for how to add image to RichTextBox:

1. In declare section, you need to add the following:


--------------------------------------------------------------------------------
Option Explicit

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"_
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)_
As Long

Private Const WM_PASTE = &H302
--------------------------------------------------------------------------------

2. Create a Sub and add the following:

--------------------------------------------------------------------------------
Private Sub Command1_Click()
' Copy the picture into the clipboard.

Clipboard.Clear
Clipboard.SetData Picture1.Picture

' Paste the picture into the RichTextBox.

myString = RichTextBox1.Text
RichTextBox1.Text = vbCrLf & vbCrLf & myString
SendMessage RichTextBox1.hwnd, WM_PASTE, 0, 0
End Sub

No comments:

Post a Comment

For other hundreds of computer repair tips, tricks, tweaks, guide, help, please go to


http://website.edusoftmax.com