Needing Help with the GFl-Active X ... basic stuff

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, xnview

Posts: 2
Joined: Sat Oct 04, 2008 6:48 pm
Location: Munich

Needing Help with the GFl-Active X ... basic stuff

Postby sonhospa » Sat Oct 04, 2008 7:29 pm


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 :arrow: 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,

Posts: 1
Joined: Fri Oct 17, 2008 2:21 pm

Postby minime » Fri Oct 17, 2008 2:29 pm

i download the sdk today too and had the same problem.
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

use it like this :

Code: Select all

        Dim pic As Bitmap = MyClass.GetPictureFromIPicture(GflAxObj.GetPicture)

Posts: 2
Joined: Sat Oct 04, 2008 6:48 pm
Location: Munich

Postby sonhospa » Sat Oct 18, 2008 6:05 am

Thank you for your answer and the code snippet, minime!
I'll try it out asap. Have a nice weekend.

Return to “GFL SDK”

Who is online

Users browsing this forum: No registered users and 1 guest