Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problems with GDI resizing images
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01019706
Message ID:
01019952
Vues:
21
Thanks Doug

This is the line it doesn't like

loBitmap.Create(loFile.ImageWidth*3,loFile.ImageHeight*3)

>Hi Colin.
>
>>I am running VFP9 and am trying to get the GDI class to resize an image im002.bmp - my code is as follows
>>
>>* Initalize GDI+
>>Set CLASSLIB to "_Gdiplus.vcx" Additive
>>
>>* Load the original image
>>Local loFile
>>loFile = CreateObject("gpBitmap")
>>loFile.CreateFromFile("im002.bmp")
>>
>>* new bitmap 3 times as large (scale factor 200%)
>>Local loBitmap
>>loBitmap = CreateObject("gpBitmap")
>>loBitmap.Create(loFile.ImageWidth*3,loFile.ImageHeight*3)
>>
>>* insert the scaled image into the new bitmap
>>Local loGP
>>loGP = CreateObject("gpGraphics")
>>loGP.CreateFromImage( m.loBitmap )
>>loGP.DrawImageScaled( m.loFile, 0,0,loFile.ImageWidth*3,loFile.ImageHeight*3 )
>>
>>* Save as JPG.
>>loBitmap.SaveToFile("test.jpg","im20.jpg")
>>
>>I get this error
>>
>>GDI + Object not created or associated
>>
>>gpBitmap
>>
>>What is the problem?
>
>Since you're not checking the return values of these methods, you're not being notified when something doesn't work. For example, CreateFromFile doesn't give an error if the specified file doesn't exist; it simply returns an error code. In that case, it doesn't set the GDI+ handle properly, which is the error you're getting. So, be sure that the file names you specify can be located (you may need to put paths on them) and check the return values of the methods to ensure they succeeded.
>
>Doug
Specialist in Advertising, Marketing, especially Direct Marketing

I run courses in Business Management and Marketing
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform