|
-
February 17th, 2000, 03:50 AM
#1
Rich Text Control (RTF)
"mypic.bmp" is a bitmap file. rtfMyText is a rich text box. It is filled with text. I do this:
x = rtfMyText.SelStart
rtfMyText.InsertOleObjectAt x, "myPic.bmp"
but alas the picture is not inserted into the rich text box after all. Indeed I don't even know andcannot find out how to insert a string in the box:
x = rtfMyText.SelStart
rtfMyText.InsertStringAt x, "Hello world!"
Anyone have any ideas on this?
Thanks,
Peter
-
February 17th, 2000, 04:45 AM
#2
Re: Rich Text Control (RTF)
For "InsertStringAt" , you can use
.SelText = NewTextString
To insert ole objects, i am checking how to do. will post it here, if i can find.
RK
-
February 17th, 2000, 05:18 AM
#3
Re: Rich Text Control (RTF)
This thing works for inserting the bmp pictures into RTB. Check it out:
Take one form. put one RTB.
Change the szfilename to valid file on your system and run
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
RK
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
|