Information générale
Catégorie:
Visual FoxPro Beta
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement