$OPTIMIZE ON
$TYPECHECK ON
DECLARE FUNCTION LoadImageFile LIB "JPEG.DLL" ALIAS "LoadImageFile" (handle AS LONG,BYREF path AS STRING) AS LONG
DECLARE FUNCTION ImageWidth LIB "JPEG.DLL" ALIAS "ImageWidth" (hImg AS LONG) AS LONG
DECLARE FUNCTION ImageHeight LIB "JPEG.DLL" ALIAS "ImageHeight" (hImg AS LONG) AS LONG
DECLARE SUB SelectPicture
CREATE Form AS QFORM
Width = 200
Height = 200
Center
OnClick = SelectPicture
CREATE Image AS QIMAGE
AutoSize = 1
Transparent = 0
Visible = 0
OnClick = SelectPicture
END CREATE
END CREATE
Application.Title = "RapidQ Picture Viewer"
Form.SHOWMODAL
SUB SelectPicture
DIM ofd AS QOPENDIALOG
ofd.Filter = "Picture Files (*.bmp, *.ico, *.jpg, *.gif, *.wmf, *.emf)|*.BMP;*.ICO;*.JPG;*.GIF;*.WMF;*.EMF|All Files (*.*)|*.*"
IF (ofd.EXECUTE) THEN
DEFSTR path = ofd.FileName
DEFINT hImg, xImg, yImg
hImg = LoadImageFile(Form.Handle, path)
xImg = ImageWidth(hImg)
yImg = ImageHeight(hImg)
Form.CAPTION = path + " (" + STR$(xImg) + " x " + STR$(yImg) + ")"
Form.ClientWidth = xImg
Form.ClientHeight = yImg
Form.Center
Image.Handle = hImg
Image.Visible = 1
END IF
END SUB
|