Hello,
I'm trying to use the ActiveX Object enclosed with the GflSDK in Visual Basic 2008 (.NET), to which I have to admit I'm pretty new... so that I stay close to the helpfile anyway. But still: when I want to assign the object to a PictureBox on a form (:arrow: MyImage.LoadBitmap(fileToDisplay), then frmHead.pbox.Image = MyImage.GetPicture), VB throws an InvalidCastException: COM Object of type "System.__COMObject" can't be converted to class type "System.Drawing.Image".
In a frequented developers forum I got the following advice: "Your code is trying to convert an object of type GflAx to a .NET Image object. That's not going to work. The GflAx object has to expose some method to return an Image object." Having assumed the LoadBitmap and GetPicture methods would return an image object, I'm confused about what I'm doing now... what did I do wrong?
Would you please be so kind as to lead me out of the trap
Thank you so much,
regards
Michael
Needing Help with the GFl-Active X ... basic stuff
Moderators: XnTriq, helmut, xnview
-
- Posts: 2
- Joined: Sat Oct 04, 2008 6:48 pm
- Location: Munich
-
- Posts: 1
- Joined: Fri Oct 17, 2008 2:21 pm
i download the sdk today too and had the same problem.
u have to convert the IPicture format.
create this class :
use it like this :
u have to convert the IPicture format.
create this class :
Code: Select all
Private NotInheritable Class myClass
Inherits System.Windows.Forms.AxHost
Public Shared Shadows Function GetPictureFromIPicture(ByVal picture As Object) As Image
Return AxHost.GetPictureFromIPicture(picture)
End Function
End Class
Code: Select all
Dim pic As Bitmap = MyClass.GetPictureFromIPicture(GflAxObj.GetPicture)
-
- Posts: 2
- Joined: Sat Oct 04, 2008 6:48 pm
- Location: Munich