runsnake 0 Posted August 10, 2011 Hi, Please help me. I want create control of some GUI window, in this control: can Add a image or more to display dynamically; can remove some selected image and remains of images sorted automatically can drag some image to other image position for sorting images For simplify, all image have the same size. Share this post Link to post Share on other sites
wakillon 403 Posted August 10, 2011 (edited) For drag a bmp and display it on the gui, try this : #include <WindowsConstants.au3> #include <GUIConstants.au3> GUICreate ( "Test", 300, 200, -1, -1, -1, $WS_EX_ACCEPTFILES + $WS_EX_TOPMOST ) GUICtrlCreateLabel ( "", -1, -1, 300, 200 ) GUICtrlSetState ( -1, $GUI_DISABLE + $GUI_DROPACCEPTED ) $_Pic = GUICtrlCreatePic ( "", 0, 0, 300, 200 ) GUISetState ( ) While 1 $msg = GUIGetMsg ( ) Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED ConsoleWrite ( "@GUI_DRAGFILE : " & @GUI_DRAGFILE & @Crlf ) GUICtrlSetImage ( $_Pic, @GUI_DRAGFILE ) EndSwitch WEnd for remove it, add a button for set GUICtrlSetImage ( $_Pic, '' ) Edited August 10, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
runsnake 0 Posted August 10, 2011 For drag a bmp and display it on the gui, try this : #include <WindowsConstants.au3> #include <GUIConstants.au3> GUICreate ( "Test", 300, 200, -1, -1, -1, $WS_EX_ACCEPTFILES + $WS_EX_TOPMOST ) GUICtrlCreateLabel ( "", -1, -1, 300, 200 ) GUICtrlSetState ( -1, $GUI_DISABLE + $GUI_DROPACCEPTED ) $_Pic = GUICtrlCreatePic ( "", 0, 0, 300, 200 ) GUISetState ( ) While 1 $msg = GUIGetMsg ( ) Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_DROPPED ConsoleWrite ( "@GUI_DRAGFILE : " & @GUI_DRAGFILE & @Crlf ) GUICtrlSetImage ( $_Pic, @GUI_DRAGFILE ) EndSwitch WEnd for remove it, add a button for set GUICtrlSetImage ( $_Pic, '' ) Thanks a lot for your so fast reply. But I want the effects as the record: http://min.us/m3LR2E I don't know how to start Share this post Link to post Share on other sites
wakillon 403 Posted August 10, 2011 Thanks a lot for your so fast reply.But I want the effects as the record: http://min.us/m3LR2EI don't know how to startGood Luck ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
runsnake 0 Posted August 10, 2011 where is my luck? Share this post Link to post Share on other sites
monoscout999 10 Posted August 11, 2011 This is a lot bugged but you can have an idea looking at this. expandcollapse popup#include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <StaticConstants.au3> Global $checkCursor $Image1 = @ScriptDir & "\Pic1.jpg" $Image2 = @ScriptDir & "\Pic2.Jpg" If Not FileExists($Image1) Then InetGet("http://i273.photobucket.com/albums/jj239/StarcraftImages/MCR.jpg", $Image1) If Not FileExists($Image2) Then InetGet("http://www.autoitscript.com/forum/uploads/av-28198.gif", $Image2) ; Sorry Wakillon ;S $hGui = GUICreate("Drag Me! and Rezise Me by Monoscout999") $Pic1 = GUICtrlCreatePic($Image1, 10, 10, 200, 200, $SS_SUNKEN) $Pic2 = GUICtrlCreatePic($Image2, 200, 200, 200, 200, $SS_SUNKEN) $Pic1Size = ControlGetPos($hGui, "", $Pic1) $Pic2Size = ControlGetPos($hGui, "", $Pic2) GUISetState() While True $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit EndSwitch $aMouse = GUIGetCursorInfo() If @error Then ContinueLoop Switch $aMouse[2] Case 1 Switch $aMouse[4] Case $Pic1 Select Case $aMouse[0] > $Pic1Size[0] And $aMouse[0] < $Pic1Size[0] + $Pic1Size[2] And $aMouse[1] > $Pic1Size[1] And $aMouse[1] < $Pic1Size[1] + $Pic1Size[3] Do $aMouse2 = GUIGetCursorInfo() If $aMouse2[0] <> $aMouse[0] Then ControlMove($hGui, "", $Pic1, $Pic1Size[0] + ($aMouse2[0] - $aMouse[0]), $Pic1Size[1] + ($aMouse2[1] - $aMouse[1])) EndIf Until $aMouse2[2] = 0 $aMouse = GUIGetCursorInfo() EndSelect Case $Pic2 Select Case $aMouse[0] > $Pic2Size[0] And $aMouse[0] < $Pic2Size[0] + $Pic2Size[2] And $aMouse[1] > $Pic2Size[1] And $aMouse[1] < $Pic2Size[1] + $Pic2Size[3] Do $aMouse2 = GUIGetCursorInfo() If $aMouse2[0] <> $aMouse[0] Then ControlMove($hGui, "", $Pic2, $Pic2Size[0] + ($aMouse2[0] - $aMouse[0]), $Pic2Size[1] + ($aMouse2[1] - $aMouse[1])) EndIf Until $aMouse2[2] = 0 $aMouse = GUIGetCursorInfo() EndSelect EndSwitch Case 0 Switch $aMouse[4] Case $Pic1 Select Case $aMouse[0] > $Pic1Size[0] And $aMouse[0] < $Pic1Size[0] + $Pic1Size[2] And $aMouse[1] > $Pic1Size[1] And $aMouse[1] < $Pic1Size[1] + $Pic1Size[3] If $checkCursor = False Then GUISetCursor(9) $checkCursor = Not $checkCursor EndIf EndSelect Case $Pic2 Select Case $aMouse[0] > $Pic2Size[0] And $aMouse[0] < $Pic2Size[0] + $Pic2Size[2] And $aMouse[1] > $Pic2Size[1] And $aMouse[1] < $Pic2Size[1] + $Pic2Size[3] If $checkCursor = False Then GUISetCursor(9) $checkCursor = Not $checkCursor EndIf EndSelect Case Else If $checkCursor = True Then GUISetCursor(-2) ; just a random invalid ID to $checkCursor = Not $checkCursor EndIf EndSwitch EndSwitch WEnd Share this post Link to post Share on other sites
wakillon 403 Posted August 11, 2011 This is a lot bugged but you can have an idea looking at this.it's not just move picture he wants, but drag & drop them when they are in the gui for move them out of the gui ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
monoscout999 10 Posted August 11, 2011 it's not just move picture he wants, but drag & drop them when they are in the gui for move them out of the gui !ah ok now i get it Share this post Link to post Share on other sites