Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Load images into a form using GDIPlus library
Message
De
06/10/2004 14:36:47
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Divers
Thread ID:
00949200
Message ID:
00949299
Vues:
11
Joel is right when he points out the hWND is not a graphics handle. This will be the cause of the exception on your DrawImageScaled call.

oGDI = CREATEOBJECT("GPGraphics")
oGDIImage = CREATEOBJECT("GPImage")
* NOT this: ?oGDI.SetHandle(oForm.HWnd)
* but this instead
oGDI.CreateFromHWND( oForm.HWND )
* Also not this for same reason: ?oGDIImage.SetHandle(oForm.HWnd)
* But this was correct:
?oGDIImage.CreateFromFile("C:\SampleImage.jpg")

* You shouldn't get an exception here now!
?oGDI.DrawImageScaled(oGDIImage, oForm.ctrShape.Left, oForm.ctrShape.Top, oForm.ctrShape.Width, oForm.ctrShape.Height)

Of course, your code would be a lot simpler for this particular case if you simply used a Fox Image control and set Thisform.Image1.Picture = "c:\sampleimage.jpg" - I assume that you have a more difficult task in mind and this is just your path towards it. Good luck!

- Walter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform