Guidance
指路人
g.yi.org
software / rapidq / Examples / Graphics & Animation / jpeg.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
     $OPTIMIZE ON
     $TYPECHECK ON

'The path must be either a string variable passed by reference or a pointer to a string variable
     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 'copy the result of the property into a variable that can be passed into the DLL call
       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
掌柜推荐
 
 
¥477.00 ·
 
 
¥918.00 ·
 
 
¥370.00 ·
 
 
¥271.00 ·
 
 
¥995.00 ·
 
 
¥1,580.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2005-02-17 01:02:00