Information générale
Catégorie:
Codage, syntaxe et commandes
>Is there a command in VFP6 to capture the height and width of a jpg or gif?
See code below...
>Also, does jpg/gif support mean that jpgs and gifs can be added to forms?
Yes, JPG's and GIFS can be used where BMP's can be used. However, animated gifs - while you can view them - the image is static.
Try this code:
o = createobject("cuspicture")
o.loadpicture
?o.picturewidth
?o.pictureheight
Define Class cusPicture as Custom
Picturefile= Null
PictureWidth = 0
PictureHeight = 0
PROCEDURE loadpicture
lParameters cFile
Local oFile,oConvert
oConvert = CreateObject("cusScaleConvert")
*/ This will reset the Picture Object Reference
If Type("Cfile") # "C" Or !File(cFile)
cFile = GetPict()
Endif
If !Empty(cFile) And File(cFile)
oFile = LoadPicture(cFile)
If Type("oFile") = "O" And ;
!IsNull(oFile)
With This
.PictureFile = oFile
.PictureWidth = oFile.Width/oConvert.nFactorX
.PictureHeight = oFile.Height/oConvert.nFactorY
EndWith
Endif
Endif
Return
ENDPROC
EndDefine
DEFINE CLASS cusscaleconvert AS custom
nfactorx = 0
nfactory = 0
Name = "cusscaleconvert"
PROCEDURE convert
LOCAL lihwnd,lihdc,lipixelsperinchx,lipixelsperinchy
* Define some constants.
#DEFINE cnlog_pixels_x 88
#DEFINE cnlog_pixels_y 90
#DEFINE cntwips_per_inch 1440
DECLARE integer GetActiveWindow in WIN32API
DECLARE integer GetDC in WIN32API integer iHDC
DECLARE integer GetDeviceCaps ;
in WIN32API integer iHDC, integer iIndex
lihwnd = getactivewindow()
lihdc = getdc(lihwnd)
lipixelsperinchx = getdevicecaps(lihdc, cnlog_pixels_x)
lipixelsperinchy = getdevicecaps(lihdc, cnlog_pixels_y)
WITH This
.nfactorx = cntwips_per_inch/lipixelsperinchx
.nfactory = cntwips_per_inch/lipixelsperinchy
ENDWITH
Return
ENDPROC
PROCEDURE Init
This.Convert()
ENDPROC
ENDDEFINE
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