PDA

View Full Version : Insert image as character...


Unregistered
October 29, 2002, 10:22:42
Hello,

I'm currently trying to insert a image into my TXControl using VB.
I would to open a dialog box that permit user to choose a image file located in the local disk, and put the selected image into the TXControl at the current cursor postition (like in the Demo program included in the TXControl directory: see TXWords.exe, menu Insert \ Image as character...)
Question:
- How do that in VB?
- I thing I sould use the ObjectInsertAsChar method. Is there a method to open the dialog box with image filter included with TXControl?
- If not, how open this dialog box and put a file filter???

Thanks you,
HES


This message was originally posted by HES in the old TX Text Control Support Forum.

Meik Dankleff
October 29, 2002, 15:45:02
Here is a code snippet taken from the Text Control manual. You can find it at the bottom of the ImageFilters property:

dlgFile.DialogTitle = "Insert Image"
dlgFile.Filename = ""
dlgFile.Filter = TXTextControl1.ImageFilters
dlgFile.FilterIndex = 1
dlgFile.Flags = cdlOFNPathMustExist Or cdlOFNFileMustExist Or cdlOFNHideReadOnly
dlgFile.CancelError = True
dlgFile.ShowOpen

TXTextControl1.ObjectInsertAsChar 0, dlgFile.Filename, 1, 100, 100, 0, 0

The ImageFilters property returns a VB dialog compatible string. You can assign it directly to the Filter property of the dialog as shown above. Please refer to the documentation of this property as well.


This message was originally posted by Meik Dankleff in the old TX Text Control Support Forum.