General information
Category:
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
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only