Jump to content

Recommended Posts

Posted

Hi,

I want to make a GUI with a GUICtrlCreateInput or similar where I can move a pic per drag and drop from a broser into it.

I don't want to have the picture in it, but the information from the pic, for expample the web link of the pic.

How to realize this?

Posted

Depends on what kind of informations about image you need. If you need info like width,height or other type of informations about format, etc, it's work in this way:

#include <GDIPlus.au3>

$hMain = GUICreate("Example",400,100,Default,Default,Default,0x00000010)
$hDropLabel = GUICtrlCreateLabel('Drag && Drop Your Image Here',0,0,400,35,0x01)
GUICtrlSetFont($hDropLabel,20,700,2,"Garamond")
GUICtrlSetBkColor($hDropLabel,0x000000)
GUICtrlSetColor($hDropLabel,0xC0C0C0)
GUICtrlSetState($hDropLabel,8)
$hWidthLabel = GUICtrlCreateLabel('Width',50,40,100,20,0x01)
GUICtrlSetFont($hWidthLabel,12,600,2,"Garamond")
$hHeightLabel = GUICtrlCreateLabel('Height',250,40,100,20,0x01)
GUICtrlSetFont($hHeightLabel,12,600,2,"Garamond")
$hWidth = GUICtrlCreateLabel('',75,60,50,20,0x1001)
$hHeight = GUICtrlCreateLabel('',275,60,50,20,0x1001)
GUISetState(@SW_SHOW)

While True
    Switch GUIGetMsg()
        Case -13
            $sFile = @GUI_DragFile
            If $sFile Then
                _GDIPlus_Startup()
                $hImage = _GDIPlus_ImageLoadFromFile($sFile)
                $iW = _GDIPlus_ImageGetWidth($hImage)
                $iH = _GDIPlus_ImageGetHeight($hImage)
                _GDIPlus_ImageDispose($hImage)
                _GDIPlus_Shutdown()
                GUICtrlSetData($hWidth,$iW)
                GUICtrlSetData($hHeight,$iH)
            EndIf
        Case -3
            Exit
    EndSwitch
    Sleep(10)
WEnd

But in this case the image is copied in temporary files dir so you won't get informations like web link.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...