Bellow is the code to select, Only one image object inside my .RTF document using a Richtextbox.
--------------------------------------
Imports System.Drawing.Imaging
Imports System.Runtime.InteropServices
Public Class Form14
Public Const CF_ENHMETAFILE As Integer = 14
<DllImport("user32.dll", EntryPoint:="OpenClipboard", SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function OpenClipboard(ByVal hWnd As IntPtr) As Boolean
End Function
<DllImport("user32.dll", EntryPoint:="GetClipboardData", SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function GetClipboardData(ByVal uFormat As Integer) As IntPtr
End Function
<DllImport("user32.dll")> Private Shared Function CloseClipboard() As Boolean
End Function
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
RichTextBox1.LoadFile("C:\testimg.rtf")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.Copy()
If OpenClipboard(Me.Handle) Then
Try
Dim MF As New Metafile(GetClipboardData(CF_ENHMETAFILE), True)
MF.Save("C:\MF.bmp", ImageFormat.Bmp)
CloseClipboard()
Catch ex As Exception
MessageBox.Show(ex.Message + "You need to select a image object")
End Try
End If
End Sub
End Class
-----------------
So this code is perfectly for selecting one image object at a time, and also we have to use mouse to select one image object to the clipboard at a time,
Now my problem is i have a collection of RTF document , so if i take one .RTF document which will contanming morethan one image objects, now what i have to do is i need to select each image object inside my RTF document and save in to the hard drive without selecting each one using a mouse, basicall how do i select multiple image object to the clipboard ?
how do i select multiple image object inside the .RTF document without using a mouse ?
please help me. ?
regards
suis