|
-
Aug 31st, 2000, 01:52 PM
#1
Hi,
Could anyone please tell me how can i insert images into a Rich Text Box.
Thanks in advance.
-
Jan 27th, 2001, 04:33 AM
#2
New Member
Const WM_CUT = &H300
Const WM_COPY = &H301
Const WM_PASTE = &H302
Const WM_CLEAR = &H303
Const WM_UNDO = &H3040
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
Private Sub mnuinsertimagine_Click()
On Error GoTo eroare
CommonDialog1.CancelError = True
With CommonDialog1
.DialogTitle = "Fisier imagine..."
.Filter = "Imagini: *.bmp;*jpg;*.gif;*.emf|*.bmp;*jpg;*.gif;*.emf"
.ShowOpen 'show the dialog box
Picture1.Picture = LoadPicture(.FileName)
End With
Clipboard.Clear
Clipboard.SetData Picture1.Picture
SendMessage rtb.hWnd, WM_PASTE, 0, 0
Exit Sub
eroare:
Err.Clear
Exit Sub
End Sub
-
Jan 28th, 2001, 10:51 AM
#3
Hyperactive Member
This code snippet I had lying around might also help you:
Code:
Option Explicit
Private Sub Form_Click()
RichTextBox1.SelStart = 3
RichTextBox1.SelText = "[new hi there]"
End Sub
Private Sub Form_DblClick()
Dim lpobj As OLEObject
Dim szfilename As String
szfilename = App.Path & "\ttt444.bmp" ' put some valid file name here
Set lpobj = RichTextBox1.OLEObjects.Add(, , szfilename)
lpobj.DisplayType = rtfDisplayContent
' if you un comment the following line you will go to edit mode:
'lpobj.DoVerb
End Sub
Private Sub Form_Load()
Me.RichTextBox1.Text = "Hi there"
End Sub
-
Feb 5th, 2007, 10:56 AM
#4
Lively Member
Re: Inserting Picture
I got errors: (VS 2005)
Dim lpobj As OLEObject ----> not defined
Set lpobj = RichTextBox1.OLEObjects.Add(, , szfilename)----> OLEobjects is not a member of RichText...
Why???
-
Feb 5th, 2007, 12:02 PM
#5
Hyperactive Member
Re: Inserting Picture
 Originally Posted by BorisAro
I got errors: (VS 2005)
Dim lpobj As OLEObject ----> not defined
Set lpobj = RichTextBox1.OLEObjects.Add(, , szfilename)----> OLEobjects is not a member of RichText...
Why???
You can use Miaourice's example, it will work. The only downside is you have to copy the image to the clipboard first, which is a pain. But I'm sure if you research it enough, there's a way around that.
God put me on this earth to do many great things, and I'm so far behind that I'm going to live forever.
I'm programming for Windows using a Apple Mac Mini, 1.5Ghz with 512MB DDR RAM. I feel like I'm committing a crime :P
-
Feb 5th, 2007, 01:37 PM
#6
Lively Member
Re: Inserting Picture
Thank You. My major problem - how to get from mdg Ole object file .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|