davidkim Posted August 23, 2013 Share Posted August 23, 2013 (edited) http://ho82.kr/au3/slide.swf Preview 1 Preview 2 slider download Download is valid until 2013/10/23 code expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=C:\AutoIt3\Aut2Exe\Icons\SETUP09.ICO #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Include <GDIPlus.au3> #Include <WindowsConstants.au3> #include <WinAPI.au3> #include <GUIConstantsEx.au3> Global Const $tagBITMAP = 'long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;' Global Const $SC_DRAGMOVE = 0xF012 Global $tick_back_png,$tick_hi,$tick_wi,$tick1_png,$tick2_png,$bu1_png,$bu2_png Global $tick = 295 ,$button = 0 Global $tx3 = 430 Global $y3 Global $bx3 Global $by3 = 341 Global $fDragging = False HotKeySet("{ESC}",'_exit_') _GDIPlus_Startup() _LoadTick() $tick_back_form = GUICreate('', 591, 395, -1, -1, $WS_POPUP, $WS_EX_LAYERED) GUISetState() setpng_back($tick_back_png,0) $tick_form = GUICreate("", 54, 55, 430 , 295,$WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $tick_back_form) GUISetState() setpng_tick($tick_form,$tick1_png) $button_form = GUICreate('', 54, 55, 50,341 ,$WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $tick_back_form) GUISetState() setpng_tick($button_form,$bu1_png) ; if form movement size display/move limit GUIRegisterMsg($WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING") ;~ $SPI_GETDRAGFULLWINDOWS = 38 ;~ $SPI_SETDRAGFULLWINDOWS = 37 Global $result = DllStructCreate("int") ; system value backup DllCall("User32.dll", "int", "SystemParametersInfo", "int", 38, "int", 0, "ptr", DllStructGetPtr($result), "int", 0) ;windows move / mouse down and drag set value DllCall("User32.dll", "int", "SystemParametersInfo", "int", 37, "int", 1, "ptr", 0, "int", 0) While 1 _ReduceMemory(@AutoItPID) $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $tick_back_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN $fDragging = False ;no tick/button to $WM_WINDOWPOSCHANGING _SendMessage($tick_back_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ;move can EndSwitch Case $tick_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN setpng_tick($tick_form,$tick2_png) ; Lamp ON $fDragging = True ; yes tick/button to $WM_WINDOWPOSCHANGING $pos = WinGetPos($tick_back_form,'') $tpos = WinGetPos($tick_form,'') $y3 = $tpos[1]-$pos[1] _SendMessage($tick_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ; move can Case $GUI_EVENT_PRIMARYUP setpng_tick($tick_form,$tick1_png) ; Lamp OFF $fDragging = False EndSwitch Case $button_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN setpng_tick($button_form,$bu2_png) ; Lamp ON $fDragging = True ; yes tick/button to $WM_WINDOWPOSCHANGING $pos = WinGetPos($tick_back_form,'') $bpos = WinGetPos($button_form) $bx3 = $bpos[0] - $pos[0] _SendMessage($button_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) Case $GUI_EVENT_PRIMARYUP setpng_tick($button_form,$bu1_png); Lamp OFF $fDragging = False EndSwitch EndSwitch WEnd Func _exit_() DllCall("User32.dll", "int", "SystemParametersInfo", "int", 37, "int", DllStructGetData($result, 1), "ptr", 0, "int", 0) _GDIPlus_Shutdown() Exit EndFunc Func WM_WINDOWPOSCHANGING($hWnd, $Msg, $wParam, $lParam) If $hWnd = $tick_form And $fDragging = True Then ; move tick $pos = WinGetPos($tick_back_form,'') $tpos = WinGetPos($tick_form) Local $iY = $tpos[1] ; now Y Pos Local $iY_Min = $pos[1]+90 ; y min Local $iY_Max = $pos[1]+300 ; y max Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $NowPosition = $pos[0]+$tx3 Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) setpng_back($tick_back_png,210-($iY_Max-$iY),1) ; move area calc $tick = 210-($iY_Max-$iY) ; Last Position Store If $iTop < $iY_Min Then DllStructSetData($stWinPos, 4, $iY_Min) If $iTop > $iY_Max Then DllStructSetData($stWinPos, 4, $iY_Max) If $iLeft <> $NowPosition Then DllStructSetData($stWinPos, 3, $pos[0]+$tx3) ; x position fixed EndIf If $hWnd = $button_form And $fDragging = True Then $pos = WinGetPos($tick_back_form,'') $bpos = WinGetPos($button_form) Local $iX = $bpos[0] ; now X Pos Local $iX_Min = $pos[0]+50 ; x min Local $iX_Max = $pos[0]+481 ; x max Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $NowPosition = $pos[1]+$by3 Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) setpng_back($tick_back_png, 451-($iX_Max-$iX),2) ; move area calc $button = 451-($iX_Max-$iX) ; Last Position Store If $iLeft < $iX_Min Then DllStructSetData($stWinPos, 3, $iX_Min) If $iLeft > $iX_Max Then DllStructSetData($stWinPos, 3, $iX_Max) If $iTop <> $NowPosition Then DllStructSetData($stWinPos, 4, $pos[1]+$by3) ; y position fixed EndIf EndFunc Func _ReduceMemory($i_PID = -1) If $i_PID <> -1 Then Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID) Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0]) DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0]) Else Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1) EndIf Return $ai_Return[0] EndFunc ;==>_ReduceMemory Func setpng_back($png,$hper,$mode = 0) Local $graph, $hImage $hImage = _GDIPlus_ImageClone($png) $graph = _GDIPlus_ImageGetGraphicsContext($hImage) ; create memory blank area If $mode = 2 Then Set_Progress_W($graph,$hper,$tick_wi) Set_Progress_H($graph,$tick,$tick_hi) EndIf If $mode = 1 Then Set_Progress_H($graph,$hper,$tick_hi) Set_Progress_W($graph,$button,$tick_wi) EndIf _WinAPI_UpdateLayeredWindowEx($tick_back_form, _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage), 255, 1) _GDIPlus_GraphicsSetSmoothingMode($graph, 4) _GDIPlus_GraphicsDispose($graph) _GDIPlus_ImageDispose($hImage) EndFunc Func Set_Progress_W($graph,$ct,$png) _GDIPlus_GraphicsDrawImageRectRect($graph, $png, _ 0, 0 ,$ct,12, _ 70, 355 ,$ct ,12) EndFunc Func Set_Progress_H($graph,$ct,$png) _GDIPlus_GraphicsDrawImageRectRect($graph, $png, _ 0, $ct ,12,240-$ct , _ 450, $ct+95, 12 ,240-$ct) EndFunc Func setpng_tick($hForm,$png) Local $graph, $hImage $hImage = _GDIPlus_ImageClone($png) $graph = _GDIPlus_ImageGetGraphicsContext($hImage) _WinAPI_UpdateLayeredWindowEx($hForm, _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage), 255, 1) _GDIPlus_GraphicsSetSmoothingMode($graph, 4) _GDIPlus_GraphicsDispose($graph) _GDIPlus_ImageDispose($hImage) EndFunc Func _GDIPlus_ImageClone($hImage) Local $aResult = DllCall($ghGDIPDll, 'uint', 'GdipCloneImage', 'ptr', $hImage, 'ptr*', 0) If @error Then Return SetError(1, 0, 0) Else If $aResult[0] Then Return SetError($aResult[0], 0, 0) EndIf EndIf Return $aResult[2] EndFunc ;==>_GDIPlus_ImageClone Func _WinAPI_UpdateLayeredWindowEx($hWnd, $hBitmap, $iOpacity = 255, $fDelete = 0) Local $Ret, $tSIZE, $tPOINT, $tBLENDFUNCTION, $hDC, $hDestDC, $hDestSv $Ret = DllCall('user32.dll', 'hwnd', 'GetDC', 'hwnd', $hWnd) $hDC = $Ret[0] $Ret = DllCall('gdi32.dll', 'hwnd', 'CreateCompatibleDC', 'hwnd', $hDC) $hDestDC = $Ret[0] $Ret = DllCall('gdi32.dll', 'hwnd', 'SelectObject', 'hwnd', $hDestDC, 'ptr', $hBitmap) $hDestSv = $Ret[0] $tSIZE = _WinAPI_GetBitmapDimension($hBitmap) $tPOINT = DllStructCreate($tagPOINT) $tBLENDFUNCTION = DllStructCreate($tagBLENDFUNCTION) DllStructSetData($tBLENDFUNCTION, 'Alpha', $iOpacity) DllStructSetData($tBLENDFUNCTION, 'Format', 1) $Ret = DllCall('user32.dll', 'int', 'UpdateLayeredWindow', 'hwnd', $hWnd, 'hwnd', $hDC, 'ptr', 0, 'ptr', DllStructGetPtr($tSIZE), 'hwnd', $hDestDC, 'ptr', DllStructGetPtr($tPOINT), 'dword', 0, 'ptr', DllStructGetPtr($tBLENDFUNCTION), 'dword', 0x02) DllCall('user32.dll', 'int', 'ReleaseDC', 'hwnd', $hWnd, 'hwnd', $hDC) DllCall('gdi32.dll', 'ptr', 'SelectObject', 'hwnd', $hDestDC, 'ptr', $hDestSv) DllCall('gdi32.dll', 'int', 'DeleteDC', 'hwnd', $hDestDC) If Not $Ret[0] Then Return SetError(1, 0, 0) EndIf If $fDelete Then _WinAPI_DeleteObject($hBitmap) EndIf Return 1 EndFunc ;==>_WinAPI_UpdateLayeredWindowEx Func _WinAPI_GetBitmapDimension($hBitmap) Local $tObj = DllStructCreate($tagBITMAP) Local $Ret = DllCall('gdi32.dll', 'int', 'GetObject', 'int', $hBitmap, 'int', DllStructGetSize($tObj), 'ptr', DllStructGetPtr($tObj)) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0) EndIf Local $tSIZE = DllStructCreate($tagSIZE) DllStructSetData($tSIZE, 1, DllStructGetData($tObj, 'bmWidth')) DllStructSetData($tSIZE, 2, DllStructGetData($tObj, 'bmHeight')) Return $tSIZE EndFunc ;==>_WinAPI_GetBitmapDimension Func _LoadTick() $tick_back_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_back.png') $tick_hi = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_hi.png') $tick_wi = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_wi.png') $tick1_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_1.png') $tick2_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_2.png') $bu1_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\bu_1.png') $bu2_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\bu_2.png') EndFunc Edited August 23, 2013 by davidkim mesale0077 and jaberwacky 2 I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks. Link to comment Share on other sites More sharing options...
wakillon Posted August 23, 2013 Share Posted August 23, 2013 Nicely done ! Is there a way to turn the button ? AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
davidkim Posted August 23, 2013 Author Share Posted August 23, 2013 Nicely done ! Is there a way to turn the button ? Dial Butto is Hard... I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks. Link to comment Share on other sites More sharing options...
jaberwacky Posted August 23, 2013 Share Posted August 23, 2013 You could make it so that when the user clicks the button on the blue dot and then drags the mouse in a positive direction then the dial will rotate on its axis using a simple bresenham algorithm. LIkewise for when the user drags the mouse left. It's a start at least. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
davidkim Posted August 23, 2013 Author Share Posted August 23, 2013 You could make it so that when the user clicks the button on the blue dot and then drags the mouse in a positive direction then the dial will rotate on its axis using a simple bresenham algorithm. LIkewise for when the user drags the mouse left. It's a start at least. bresenham algorithm : How to ?????? it can dragable dial button??? I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks. Link to comment Share on other sites More sharing options...
UEZ Posted August 23, 2013 Share Posted August 23, 2013 (edited) Dial Butto is Hard...But I'm harder - die hardest. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=C:\AutoIt3\Aut2Exe\Icons\SETUP09.ICO #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Include <GDIPlus.au3> #Include <WindowsConstants.au3> #include <WinAPI.au3> #include <GUIConstantsEx.au3> If @AutoItVersion < "3.3.9.18" Then Exit MsgBox(16, "Error", "AutoIt version 3.3.9.18 or higher needed!") ;~ Global Const $tagBITMAP = 'long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;' Global Const $SC_DRAGMOVE = 0xF012 Global $tick_back_png,$tick_hi,$tick_wi,$tick1_png,$tick2_png,$bu1_png,$bu2_png Global $tick = 295 ,$button = 0 Global $tx3 = 430 Global $y3 Global $bx3 Global $by3 = 341 Global $fDragging = False HotKeySet("{ESC}",'_exit_') _GDIPlus_Startup() _LoadTick() $tick_back_form = GUICreate('', 591, 395, -1, -1, $WS_POPUP, $WS_EX_LAYERED) GUISetState() Global $hImage_Btn = _GDIPlus_BitmapCreateFromScan0(211, 211) Global $hCtxt_Btn = _GDIPlus_ImageGetGraphicsContext($hImage_Btn) _GDIPlus_GraphicsDrawImageRectRect($hCtxt_Btn, $tick_back_png, 103, 118, 211, 211, 0, 0, 211, 211) _GDIPlus_ImageDispose($hCtxt_Btn) Setpng_back($tick_back_png,0, 0, -123) $tick_form = GUICreate("", 54, 55, 430 , 295,$WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $tick_back_form) GUISetState() setpng_tick($tick_form,$tick1_png) $button_form = GUICreate('', 54, 55, 50,341 ,$WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $tick_back_form) GUISetState() setpng_tick($button_form,$bu1_png) ; if form movement size display/move limit GUIRegisterMsg($WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING") ;~ $SPI_GETDRAGFULLWINDOWS = 38 ;~ $SPI_SETDRAGFULLWINDOWS = 37 Global $result = DllStructCreate("int") ; system value backup DllCall("User32.dll", "int", "SystemParametersInfo", "int", 38, "int", 0, "ptr", DllStructGetPtr($result), "int", 0) ;windows move / mouse down and drag set value DllCall("User32.dll", "int", "SystemParametersInfo", "int", 37, "int", 1, "ptr", 0, "int", 0) While 1 ;~ _ReduceMemory(@AutoItPID) $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $tick_back_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN $fDragging = False ;no tick/button to $WM_WINDOWPOSCHANGING _SendMessage($tick_back_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ;move can EndSwitch Case $tick_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN setpng_tick($tick_form,$tick2_png) ; Lamp ON $fDragging = True ; yes tick/button to $WM_WINDOWPOSCHANGING $pos = WinGetPos($tick_back_form,'') $tpos = WinGetPos($tick_form,'') $y3 = $tpos[1]-$pos[1] _SendMessage($tick_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ; move can Case $GUI_EVENT_PRIMARYUP setpng_tick($tick_form,$tick1_png) ; Lamp OFF $fDragging = False EndSwitch Case $button_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN setpng_tick($button_form,$bu2_png) ; Lamp ON $fDragging = True ; yes tick/button to $WM_WINDOWPOSCHANGING $pos = WinGetPos($tick_back_form,'') $bpos = WinGetPos($button_form) $bx3 = $bpos[0] - $pos[0] _SendMessage($button_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) Case $GUI_EVENT_PRIMARYUP setpng_tick($button_form,$bu1_png); Lamp OFF $fDragging = False EndSwitch EndSwitch WEnd Func _exit_() DllCall("User32.dll", "int", "SystemParametersInfo", "int", 37, "int", DllStructGetData($result, 1), "ptr", 0, "int", 0) _GDIPlus_BitmapDispose($hImage_Btn) _GDIPlus_Shutdown() Exit EndFunc Func WM_WINDOWPOSCHANGING($hWnd, $Msg, $wParam, $lParam) If $hWnd = $tick_form And $fDragging = True Then ; move tick $pos = WinGetPos($tick_back_form,'') $tpos = WinGetPos($tick_form) Local $iY = $tpos[1] ; now Y Pos Local $iY_Min = $pos[1]+90 ; y min Local $iY_Max = $pos[1]+300 ; y max Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $NowPosition = $pos[0]+$tx3 Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) setpng_back($tick_back_png,210-($iY_Max-$iY),1, -500) ; move area calc $tick = 210-($iY_Max-$iY) ; Last Position Store If $iTop < $iY_Min Then DllStructSetData($stWinPos, 4, $iY_Min) If $iTop > $iY_Max Then DllStructSetData($stWinPos, 4, $iY_Max) If $iLeft <> $NowPosition Then DllStructSetData($stWinPos, 3, $pos[0]+$tx3) ; x position fixed EndIf If $hWnd = $button_form And $fDragging = True Then $pos = WinGetPos($tick_back_form,'') $bpos = WinGetPos($button_form) Local $iX = $bpos[0] ; now X Pos Local $iX_Min = $pos[0]+50 ; x min Local $iX_Max = $pos[0]+481 ; x max Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $NowPosition = $pos[1]+$by3 Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) $button = 451-($iX_Max-$iX) ; Last Position Store Local $fAngle = 180 * (-20 + $button) / 431 - 123 setpng_back($tick_back_png, 451-($iX_Max-$iX),2, $fAngle) ; move area calc If $iLeft < $iX_Min Then DllStructSetData($stWinPos, 3, $iX_Min) If $iLeft > $iX_Max Then DllStructSetData($stWinPos, 3, $iX_Max) If $iTop <> $NowPosition Then DllStructSetData($stWinPos, 4, $pos[1]+$by3) ; y position fixed EndIf EndFunc Func _ReduceMemory($i_PID = -1) If $i_PID <> -1 Then Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID) Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0]) DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0]) Else Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1) EndIf Return $ai_Return[0] EndFunc ;==>_ReduceMemory Func setpng_back($png,$hper,$mode = 0, $f = 0) Local Static $fAngle If $f <> -500 Then $fAngle = $f Local $graph, $hImage, $hHBitmap $hImage = _GDIPlus_ImageClone($png) $graph = _GDIPlus_ImageGetGraphicsContext($hImage) ; create memory blank area If $mode = 2 Then Set_Progress_W($graph,$hper,$tick_wi) Set_Progress_H($graph,$tick,$tick_hi) EndIf If $mode = 1 Then Set_Progress_H($graph,$hper,$tick_hi) Set_Progress_W($graph,$button,$tick_wi) EndIf If $fAngle <> -500 Then Local $hBmp_BG = _GDIPlus_ImageRotateAtPointEllipse($hImage_Btn, $fAngle) ;-123 to 57 _GDIPlus_GraphicsDrawImageRectRect($graph, $hBmp_BG, 0, 0, 211, 211, 103, 118, 211, 211) _GDIPlus_BitmapDispose($hBmp_BG) EndIf $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_UpdateLayeredWindowEx($tick_back_form, $hHBitmap, 255, 1) _GDIPlus_GraphicsSetSmoothingMode($graph, 4) _GDIPlus_GraphicsDispose($graph) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hHBitmap) EndFunc Func Set_Progress_W($graph,$ct,$png) _GDIPlus_GraphicsDrawImageRectRect($graph, $png, _ 0, 0 ,$ct,12, _ 70, 355 ,$ct ,12) EndFunc Func Set_Progress_H($graph,$ct,$png) _GDIPlus_GraphicsDrawImageRectRect($graph, $png, _ 0, $ct ,12,240-$ct , _ 450, $ct+95, 12 ,240-$ct) EndFunc Func setpng_tick($hForm,$png) Local $graph, $hImage, $hHBitmap $hImage = _GDIPlus_ImageClone($png) $graph = _GDIPlus_ImageGetGraphicsContext($hImage) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_UpdateLayeredWindowEx($hForm, $hHBitmap, 255, 1) _GDIPlus_GraphicsSetSmoothingMode($graph, 4) _GDIPlus_GraphicsDispose($graph) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hHBitmap) EndFunc Func _GDIPlus_ImageClone($hImage) Local $aResult = DllCall($ghGDIPDll, 'uint', 'GdipCloneImage', 'ptr', $hImage, 'ptr*', 0) If @error Then Return SetError(1, 0, 0) Else If $aResult[0] Then Return SetError($aResult[0], 0, 0) EndIf EndIf Return $aResult[2] EndFunc ;==>_GDIPlus_ImageClone Func _WinAPI_UpdateLayeredWindowEx($hWnd, $hBitmap, $iOpacity = 255, $fDelete = 0) Local $Ret, $tSIZE, $tPOINT, $tBLENDFUNCTION, $hDC, $hDestDC, $hDestSv $Ret = DllCall('user32.dll', 'hwnd', 'GetDC', 'hwnd', $hWnd) $hDC = $Ret[0] $Ret = DllCall('gdi32.dll', 'hwnd', 'CreateCompatibleDC', 'hwnd', $hDC) $hDestDC = $Ret[0] $Ret = DllCall('gdi32.dll', 'hwnd', 'SelectObject', 'hwnd', $hDestDC, 'ptr', $hBitmap) $hDestSv = $Ret[0] $tSIZE = _WinAPI_GetBitmapDimension($hBitmap) $tPOINT = DllStructCreate($tagPOINT) $tBLENDFUNCTION = DllStructCreate($tagBLENDFUNCTION) DllStructSetData($tBLENDFUNCTION, 'Alpha', $iOpacity) DllStructSetData($tBLENDFUNCTION, 'Format', 1) $Ret = DllCall('user32.dll', 'int', 'UpdateLayeredWindow', 'hwnd', $hWnd, 'hwnd', $hDC, 'ptr', 0, 'ptr', DllStructGetPtr($tSIZE), 'hwnd', $hDestDC, 'ptr', DllStructGetPtr($tPOINT), 'dword', 0, 'ptr', DllStructGetPtr($tBLENDFUNCTION), 'dword', 0x02) DllCall('user32.dll', 'int', 'ReleaseDC', 'hwnd', $hWnd, 'hwnd', $hDC) DllCall('gdi32.dll', 'ptr', 'SelectObject', 'hwnd', $hDestDC, 'ptr', $hDestSv) DllCall('gdi32.dll', 'int', 'DeleteDC', 'hwnd', $hDestDC) If Not $Ret[0] Then Return SetError(1, 0, 0) EndIf If $fDelete Then _WinAPI_DeleteObject($hBitmap) EndIf Return 1 EndFunc ;==>_WinAPI_UpdateLayeredWindowEx ;~ Func _WinAPI_GetBitmapDimension($hBitmap) ;~ Local $tObj = DllStructCreate($tagBITMAP) ;~ Local $Ret = DllCall('gdi32.dll', 'int', 'GetObject', 'int', $hBitmap, 'int', DllStructGetSize($tObj), 'ptr', DllStructGetPtr($tObj)) ;~ If (@error) Or (Not $Ret[0]) Then ;~ Return SetError(1, 0, 0) ;~ EndIf ;~ Local $tSIZE = DllStructCreate($tagSIZE) ;~ DllStructSetData($tSIZE, 1, DllStructGetData($tObj, 'bmWidth')) ;~ DllStructSetData($tSIZE, 2, DllStructGetData($tObj, 'bmHeight')) ;~ Return $tSIZE ;~ EndFunc ;==>_WinAPI_GetBitmapDimension Func _LoadTick() $tick_back_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_back.png') $tick_hi = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_hi.png') $tick_wi = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_wi.png') $tick1_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_1.png') $tick2_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_2.png') $bu1_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\bu_1.png') $bu2_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\bu_2.png') EndFunc Func _GDIPlus_ImageRotateAtPointEllipse($hImage, $fAngle, $iW = 211, $iH = 211); coded by UEZ Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $iW / 2, $iH / 2) _GDIPlus_MatrixRotate($hMatrix, $fAngle) _GDIPlus_GraphicsSetTransform($hCtxt, $hMatrix) _GDIPlus_GraphicsDrawImage($hCtxt, $hImage, -$iW / 2, -$iH / 2) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_GraphicsDispose($hCtxt) Local $hTexture = _GDIPlus_TextureCreate($hBitmap) _GDIPlus_BitmapDispose($hBitmap) $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsFillEllipse($hCtxt, 0, 0, $iW, $iH, $hTexture) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BrushDispose($hTexture) _GDIPlus_GraphicsDispose($hCtxt) Return $hBitmap EndFuncAutoIt version 3.3.9.18 or higher is needed!Move horizontal slider.Br,UEZ Edited August 23, 2013 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
wakillon Posted August 23, 2013 Share Posted August 23, 2013 Nice solution UEZ ! But my request was to add the possibility to turn button with the mouse... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
UEZ Posted August 23, 2013 Share Posted August 23, 2013 (edited) @wakillon, homework for you to implement mousemovement. Shouldn't be a real challenge for you. Br, UEZ Edited August 23, 2013 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
davidkim Posted August 24, 2013 Author Share Posted August 24, 2013 (edited) But I'm harder - die hardest. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=C:\AutoIt3\Aut2Exe\Icons\SETUP09.ICO #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Include <GDIPlus.au3> #Include <WindowsConstants.au3> #include <WinAPI.au3> #include <GUIConstantsEx.au3> If @AutoItVersion < "3.3.9.18" Then Exit MsgBox(16, "Error", "AutoIt version 3.3.9.18 or higher needed!") ;~ Global Const $tagBITMAP = 'long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;' Global Const $SC_DRAGMOVE = 0xF012 Global $tick_back_png,$tick_hi,$tick_wi,$tick1_png,$tick2_png,$bu1_png,$bu2_png Global $tick = 295 ,$button = 0 Global $tx3 = 430 Global $y3 Global $bx3 Global $by3 = 341 Global $fDragging = False HotKeySet("{ESC}",'_exit_') _GDIPlus_Startup() _LoadTick() $tick_back_form = GUICreate('', 591, 395, -1, -1, $WS_POPUP, $WS_EX_LAYERED) GUISetState() Global $hImage_Btn = _GDIPlus_BitmapCreateFromScan0(211, 211) Global $hCtxt_Btn = _GDIPlus_ImageGetGraphicsContext($hImage_Btn) _GDIPlus_GraphicsDrawImageRectRect($hCtxt_Btn, $tick_back_png, 103, 118, 211, 211, 0, 0, 211, 211) _GDIPlus_ImageDispose($hCtxt_Btn) Setpng_back($tick_back_png,0, 0, -123) $tick_form = GUICreate("", 54, 55, 430 , 295,$WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $tick_back_form) GUISetState() setpng_tick($tick_form,$tick1_png) $button_form = GUICreate('', 54, 55, 50,341 ,$WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $tick_back_form) GUISetState() setpng_tick($button_form,$bu1_png) ; if form movement size display/move limit GUIRegisterMsg($WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING") ;~ $SPI_GETDRAGFULLWINDOWS = 38 ;~ $SPI_SETDRAGFULLWINDOWS = 37 Global $result = DllStructCreate("int") ; system value backup DllCall("User32.dll", "int", "SystemParametersInfo", "int", 38, "int", 0, "ptr", DllStructGetPtr($result), "int", 0) ;windows move / mouse down and drag set value DllCall("User32.dll", "int", "SystemParametersInfo", "int", 37, "int", 1, "ptr", 0, "int", 0) While 1 ;~ _ReduceMemory(@AutoItPID) $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $tick_back_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN $fDragging = False ;no tick/button to $WM_WINDOWPOSCHANGING _SendMessage($tick_back_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ;move can EndSwitch Case $tick_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN setpng_tick($tick_form,$tick2_png) ; Lamp ON $fDragging = True ; yes tick/button to $WM_WINDOWPOSCHANGING $pos = WinGetPos($tick_back_form,'') $tpos = WinGetPos($tick_form,'') $y3 = $tpos[1]-$pos[1] _SendMessage($tick_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ; move can Case $GUI_EVENT_PRIMARYUP setpng_tick($tick_form,$tick1_png) ; Lamp OFF $fDragging = False EndSwitch Case $button_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN setpng_tick($button_form,$bu2_png) ; Lamp ON $fDragging = True ; yes tick/button to $WM_WINDOWPOSCHANGING $pos = WinGetPos($tick_back_form,'') $bpos = WinGetPos($button_form) $bx3 = $bpos[0] - $pos[0] _SendMessage($button_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) Case $GUI_EVENT_PRIMARYUP setpng_tick($button_form,$bu1_png); Lamp OFF $fDragging = False EndSwitch EndSwitch WEnd Func _exit_() DllCall("User32.dll", "int", "SystemParametersInfo", "int", 37, "int", DllStructGetData($result, 1), "ptr", 0, "int", 0) _GDIPlus_BitmapDispose($hImage_Btn) _GDIPlus_Shutdown() Exit EndFunc Func WM_WINDOWPOSCHANGING($hWnd, $Msg, $wParam, $lParam) If $hWnd = $tick_form And $fDragging = True Then ; move tick $pos = WinGetPos($tick_back_form,'') $tpos = WinGetPos($tick_form) Local $iY = $tpos[1] ; now Y Pos Local $iY_Min = $pos[1]+90 ; y min Local $iY_Max = $pos[1]+300 ; y max Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $NowPosition = $pos[0]+$tx3 Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) setpng_back($tick_back_png,210-($iY_Max-$iY),1, -500) ; move area calc $tick = 210-($iY_Max-$iY) ; Last Position Store If $iTop < $iY_Min Then DllStructSetData($stWinPos, 4, $iY_Min) If $iTop > $iY_Max Then DllStructSetData($stWinPos, 4, $iY_Max) If $iLeft <> $NowPosition Then DllStructSetData($stWinPos, 3, $pos[0]+$tx3) ; x position fixed EndIf If $hWnd = $button_form And $fDragging = True Then $pos = WinGetPos($tick_back_form,'') $bpos = WinGetPos($button_form) Local $iX = $bpos[0] ; now X Pos Local $iX_Min = $pos[0]+50 ; x min Local $iX_Max = $pos[0]+481 ; x max Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $NowPosition = $pos[1]+$by3 Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) $button = 451-($iX_Max-$iX) ; Last Position Store Local $fAngle = 180 * (-20 + $button) / 431 - 123 setpng_back($tick_back_png, 451-($iX_Max-$iX),2, $fAngle) ; move area calc If $iLeft < $iX_Min Then DllStructSetData($stWinPos, 3, $iX_Min) If $iLeft > $iX_Max Then DllStructSetData($stWinPos, 3, $iX_Max) If $iTop <> $NowPosition Then DllStructSetData($stWinPos, 4, $pos[1]+$by3) ; y position fixed EndIf EndFunc Func _ReduceMemory($i_PID = -1) If $i_PID <> -1 Then Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID) Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0]) DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0]) Else Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1) EndIf Return $ai_Return[0] EndFunc ;==>_ReduceMemory Func setpng_back($png,$hper,$mode = 0, $f = 0) Local Static $fAngle If $f <> -500 Then $fAngle = $f Local $graph, $hImage, $hHBitmap $hImage = _GDIPlus_ImageClone($png) $graph = _GDIPlus_ImageGetGraphicsContext($hImage) ; create memory blank area If $mode = 2 Then Set_Progress_W($graph,$hper,$tick_wi) Set_Progress_H($graph,$tick,$tick_hi) EndIf If $mode = 1 Then Set_Progress_H($graph,$hper,$tick_hi) Set_Progress_W($graph,$button,$tick_wi) EndIf If $fAngle <> -500 Then Local $hBmp_BG = _GDIPlus_ImageRotateAtPointEllipse($hImage_Btn, $fAngle) ;-123 to 57 _GDIPlus_GraphicsDrawImageRectRect($graph, $hBmp_BG, 0, 0, 211, 211, 103, 118, 211, 211) _GDIPlus_BitmapDispose($hBmp_BG) EndIf $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_UpdateLayeredWindowEx($tick_back_form, $hHBitmap, 255, 1) _GDIPlus_GraphicsSetSmoothingMode($graph, 4) _GDIPlus_GraphicsDispose($graph) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hHBitmap) EndFunc Func Set_Progress_W($graph,$ct,$png) _GDIPlus_GraphicsDrawImageRectRect($graph, $png, _ 0, 0 ,$ct,12, _ 70, 355 ,$ct ,12) EndFunc Func Set_Progress_H($graph,$ct,$png) _GDIPlus_GraphicsDrawImageRectRect($graph, $png, _ 0, $ct ,12,240-$ct , _ 450, $ct+95, 12 ,240-$ct) EndFunc Func setpng_tick($hForm,$png) Local $graph, $hImage, $hHBitmap $hImage = _GDIPlus_ImageClone($png) $graph = _GDIPlus_ImageGetGraphicsContext($hImage) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_UpdateLayeredWindowEx($hForm, $hHBitmap, 255, 1) _GDIPlus_GraphicsSetSmoothingMode($graph, 4) _GDIPlus_GraphicsDispose($graph) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hHBitmap) EndFunc Func _GDIPlus_ImageClone($hImage) Local $aResult = DllCall($ghGDIPDll, 'uint', 'GdipCloneImage', 'ptr', $hImage, 'ptr*', 0) If @error Then Return SetError(1, 0, 0) Else If $aResult[0] Then Return SetError($aResult[0], 0, 0) EndIf EndIf Return $aResult[2] EndFunc ;==>_GDIPlus_ImageClone Func _WinAPI_UpdateLayeredWindowEx($hWnd, $hBitmap, $iOpacity = 255, $fDelete = 0) Local $Ret, $tSIZE, $tPOINT, $tBLENDFUNCTION, $hDC, $hDestDC, $hDestSv $Ret = DllCall('user32.dll', 'hwnd', 'GetDC', 'hwnd', $hWnd) $hDC = $Ret[0] $Ret = DllCall('gdi32.dll', 'hwnd', 'CreateCompatibleDC', 'hwnd', $hDC) $hDestDC = $Ret[0] $Ret = DllCall('gdi32.dll', 'hwnd', 'SelectObject', 'hwnd', $hDestDC, 'ptr', $hBitmap) $hDestSv = $Ret[0] $tSIZE = _WinAPI_GetBitmapDimension($hBitmap) $tPOINT = DllStructCreate($tagPOINT) $tBLENDFUNCTION = DllStructCreate($tagBLENDFUNCTION) DllStructSetData($tBLENDFUNCTION, 'Alpha', $iOpacity) DllStructSetData($tBLENDFUNCTION, 'Format', 1) $Ret = DllCall('user32.dll', 'int', 'UpdateLayeredWindow', 'hwnd', $hWnd, 'hwnd', $hDC, 'ptr', 0, 'ptr', DllStructGetPtr($tSIZE), 'hwnd', $hDestDC, 'ptr', DllStructGetPtr($tPOINT), 'dword', 0, 'ptr', DllStructGetPtr($tBLENDFUNCTION), 'dword', 0x02) DllCall('user32.dll', 'int', 'ReleaseDC', 'hwnd', $hWnd, 'hwnd', $hDC) DllCall('gdi32.dll', 'ptr', 'SelectObject', 'hwnd', $hDestDC, 'ptr', $hDestSv) DllCall('gdi32.dll', 'int', 'DeleteDC', 'hwnd', $hDestDC) If Not $Ret[0] Then Return SetError(1, 0, 0) EndIf If $fDelete Then _WinAPI_DeleteObject($hBitmap) EndIf Return 1 EndFunc ;==>_WinAPI_UpdateLayeredWindowEx ;~ Func _WinAPI_GetBitmapDimension($hBitmap) ;~ Local $tObj = DllStructCreate($tagBITMAP) ;~ Local $Ret = DllCall('gdi32.dll', 'int', 'GetObject', 'int', $hBitmap, 'int', DllStructGetSize($tObj), 'ptr', DllStructGetPtr($tObj)) ;~ If (@error) Or (Not $Ret[0]) Then ;~ Return SetError(1, 0, 0) ;~ EndIf ;~ Local $tSIZE = DllStructCreate($tagSIZE) ;~ DllStructSetData($tSIZE, 1, DllStructGetData($tObj, 'bmWidth')) ;~ DllStructSetData($tSIZE, 2, DllStructGetData($tObj, 'bmHeight')) ;~ Return $tSIZE ;~ EndFunc ;==>_WinAPI_GetBitmapDimension Func _LoadTick() $tick_back_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_back.png') $tick_hi = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_hi.png') $tick_wi = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_wi.png') $tick1_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_1.png') $tick2_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_2.png') $bu1_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\bu_1.png') $bu2_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\bu_2.png') EndFunc Func _GDIPlus_ImageRotateAtPointEllipse($hImage, $fAngle, $iW = 211, $iH = 211); coded by UEZ Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $iW / 2, $iH / 2) _GDIPlus_MatrixRotate($hMatrix, $fAngle) _GDIPlus_GraphicsSetTransform($hCtxt, $hMatrix) _GDIPlus_GraphicsDrawImage($hCtxt, $hImage, -$iW / 2, -$iH / 2) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_GraphicsDispose($hCtxt) Local $hTexture = _GDIPlus_TextureCreate($hBitmap) _GDIPlus_BitmapDispose($hBitmap) $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsFillEllipse($hCtxt, 0, 0, $iW, $iH, $hTexture) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BrushDispose($hTexture) _GDIPlus_GraphicsDispose($hCtxt) Return $hBitmap EndFunc AutoIt version 3.3.9.18 or higher is needed! Move horizontal slider. Br, UEZ Thank UEZ. * ^^ * Circular dial button I want to rotate and drag directly. ㅠ.ㅠ http://ho82.kr/au3/slideUEZ.swf Edited August 24, 2013 by davidkim I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks. Link to comment Share on other sites More sharing options...
James Posted August 24, 2013 Share Posted August 24, 2013 This is very nice! Using this would certainly improve the look of the many media players created in AutoIt! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
UEZ Posted August 24, 2013 Share Posted August 24, 2013 (edited) @davidkim:Then try this: expandcollapse popup#region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=C:\AutoIt3\Aut2Exe\Icons\SETUP09.ICO #AutoIt3Wrapper_UseX64=n #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <GUIConstantsEx.au3> If @AutoItVersion < "3.3.9.18" Then Exit MsgBox(16, "Error", "AutoIt version 3.3.9.18 or higher needed!") ;~ Global Const $tagBITMAP = 'long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;' Global Const $SC_DRAGMOVE = 0xF012 Global $tick_back_png, $tick_hi, $tick_wi, $tick1_png, $tick2_png, $bu1_png, $bu2_png Global $tick = 295, $button = 0, $fDegree = 0, $iPrev = 0, $iSpeed = 2 Global $tx3 = 430 Global $y3 Global $bx3 Global $by3 = 341 Global $fDragging = False HotKeySet("{ESC}", '_exit_') _GDIPlus_Startup() _LoadTick() $tick_back_form = GUICreate('', 591, 395, -1, -1, $WS_POPUP, $WS_EX_LAYERED) $label = GUICtrlCreateLabel("", 103, 118, 211, 211) GUISetState() Global $hImage_Btn = _GDIPlus_BitmapCreateFromScan0(211, 211) Global $hCtxt_Btn = _GDIPlus_ImageGetGraphicsContext($hImage_Btn) _GDIPlus_GraphicsDrawImageRectRect($hCtxt_Btn, $tick_back_png, 103, 118, 211, 211, 0, 0, 211, 211) _GDIPlus_ImageDispose($hCtxt_Btn) setpng_back($tick_back_png, 0, 0, $fDegree) $tick_form = GUICreate("", 54, 55, 430, 295, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $tick_back_form) GUISetState() setpng_tick($tick_form, $tick1_png) $button_form = GUICreate('', 54, 55, 50, 341, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $tick_back_form) GUISetState() setpng_tick($button_form, $bu1_png) ; if form movement size display/move limit GUIRegisterMsg($WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING") ;~ $SPI_GETDRAGFULLWINDOWS = 38 ;~ $SPI_SETDRAGFULLWINDOWS = 37 Global $result = DllStructCreate("int"), $aCtrl ; system value backup DllCall("User32.dll", "int", "SystemParametersInfo", "int", 38, "int", 0, "ptr", DllStructGetPtr($result), "int", 0) ;windows move / mouse down and drag set value DllCall("User32.dll", "int", "SystemParametersInfo", "int", 37, "int", 1, "ptr", 0, "int", 0) While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $tick_back_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN $fDragging = False ;no tick/button to $WM_WINDOWPOSCHANGING $aCtrl = GUIGetCursorInfo($aMsg[1]) Switch $aCtrl[4] Case $label $iPrev = $aCtrl[0] Do $aCtrl = GUIGetCursorInfo($aMsg[1]) If $iPrev > $aCtrl[0] Then $fDegree -= $iSpeed $iPrev = $aCtrl[0] EndIf If $iPrev < $aCtrl[0] Then $fDegree += $iSpeed $iPrev = $aCtrl[0] EndIf setpng_back($tick_back_png, 0, 3, $fDegree) Until Not $aCtrl[2] * Sleep(10) Case Else _SendMessage($tick_back_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ;move can EndSwitch EndSwitch Case $tick_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN setpng_tick($tick_form, $tick2_png) ; Lamp ON $fDragging = True ; yes tick/button to $WM_WINDOWPOSCHANGING $pos = WinGetPos($tick_back_form, '') $tpos = WinGetPos($tick_form, '') $y3 = $tpos[1] - $pos[1] _SendMessage($tick_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ; move can Case $GUI_EVENT_PRIMARYUP setpng_tick($tick_form, $tick1_png) ; Lamp OFF $fDragging = False EndSwitch Case $button_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN setpng_tick($button_form, $bu2_png) ; Lamp ON $fDragging = True ; yes tick/button to $WM_WINDOWPOSCHANGING $pos = WinGetPos($tick_back_form, '') $bpos = WinGetPos($button_form) $bx3 = $bpos[0] - $pos[0] _SendMessage($button_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) Case $GUI_EVENT_PRIMARYUP setpng_tick($button_form, $bu1_png); Lamp OFF $fDragging = False EndSwitch EndSwitch WEnd Func _exit_() DllCall("User32.dll", "int", "SystemParametersInfo", "int", 37, "int", DllStructGetData($result, 1), "ptr", 0, "int", 0) _GDIPlus_BitmapDispose($hImage_Btn) _GDIPlus_Shutdown() Exit EndFunc ;==>_exit_ Func WM_WINDOWPOSCHANGING($hWnd, $Msg, $wParam, $lParam) If $hWnd = $tick_form And $fDragging = True Then ; move tick $pos = WinGetPos($tick_back_form, '') $tpos = WinGetPos($tick_form) Local $iY = $tpos[1] ; now Y Pos Local $iY_Min = $pos[1] + 90 ; y min Local $iY_Max = $pos[1] + 300 ; y max Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $NowPosition = $pos[0] + $tx3 Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) setpng_back($tick_back_png, 210 - ($iY_Max - $iY), 1, $fDegree) ; move area calc $tick = 210 - ($iY_Max - $iY) ; Last Position Store If $iTop < $iY_Min Then DllStructSetData($stWinPos, 4, $iY_Min) If $iTop > $iY_Max Then DllStructSetData($stWinPos, 4, $iY_Max) If $iLeft <> $NowPosition Then DllStructSetData($stWinPos, 3, $pos[0] + $tx3) ; x position fixed EndIf If $hWnd = $button_form And $fDragging = True Then $pos = WinGetPos($tick_back_form, '') $bpos = WinGetPos($button_form) Local $iX = $bpos[0] ; now X Pos Local $iX_Min = $pos[0] + 50 ; x min Local $iX_Max = $pos[0] + 481 ; x max Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $NowPosition = $pos[1] + $by3 Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) $button = 451 - ($iX_Max - $iX) ; Last Position Store ;~ Local $fAngle = 180 * (-20 + $button) / 431 - 123 setpng_back($tick_back_png, 451 - ($iX_Max - $iX), 2, $fDegree) ; move area calc If $iLeft < $iX_Min Then DllStructSetData($stWinPos, 3, $iX_Min) If $iLeft > $iX_Max Then DllStructSetData($stWinPos, 3, $iX_Max) If $iTop <> $NowPosition Then DllStructSetData($stWinPos, 4, $pos[1] + $by3) ; y position fixed EndIf EndFunc ;==>WM_WINDOWPOSCHANGING Func setpng_back($png, $hper, $mode = 0, $fAngle = 0) If $fAngle < -123 Then $fAngle = -123 If $fAngle > 57 Then $fAngle = 57 Local $graph, $hImage, $hHBitmap $hImage = _GDIPlus_ImageClone($png) $graph = _GDIPlus_ImageGetGraphicsContext($hImage) ; create memory blank area If $mode = 3 Then Set_Progress_H($graph, $tick, $tick_hi) Set_Progress_W($graph, $button, $tick_wi) EndIf If $mode = 2 Then Set_Progress_W($graph, $hper, $tick_wi) Set_Progress_H($graph, $tick, $tick_hi) EndIf If $mode = 1 Then Set_Progress_H($graph, $hper, $tick_hi) Set_Progress_W($graph, $button, $tick_wi) EndIf Local $hBmp_BG = _GDIPlus_ImageRotateAtCenterEllipse($hImage_Btn, $fAngle) ;-123 to 57 _GDIPlus_GraphicsDrawImageRectRect($graph, $hBmp_BG, 0, 0, 211, 211, 103, 118, 211, 211) _GDIPlus_BitmapDispose($hBmp_BG) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_UpdateLayeredWindowEx($tick_back_form, $hHBitmap, 255, 1) _GDIPlus_GraphicsSetSmoothingMode($graph, 4) _GDIPlus_GraphicsDispose($graph) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hHBitmap) EndFunc ;==>setpng_back Func Set_Progress_W($graph, $ct, $png) _GDIPlus_GraphicsDrawImageRectRect($graph, $png, _ 0, 0, $ct, 12, _ 70, 355, $ct, 12) EndFunc ;==>Set_Progress_W Func Set_Progress_H($graph, $ct, $png) _GDIPlus_GraphicsDrawImageRectRect($graph, $png, _ 0, $ct, 12, 240 - $ct, _ 450, $ct + 95, 12, 240 - $ct) EndFunc ;==>Set_Progress_H Func setpng_tick($hForm, $png) Local $graph, $hImage, $hHBitmap $hImage = _GDIPlus_ImageClone($png) $graph = _GDIPlus_ImageGetGraphicsContext($hImage) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_UpdateLayeredWindowEx($hForm, $hHBitmap, 255, 1) _GDIPlus_GraphicsSetSmoothingMode($graph, 4) _GDIPlus_GraphicsDispose($graph) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hHBitmap) EndFunc ;==>setpng_tick Func _GDIPlus_ImageClone($hImage) Local $aResult = DllCall($ghGDIPDll, 'uint', 'GdipCloneImage', 'ptr', $hImage, 'ptr*', 0) If @error Then Return SetError(1, 0, 0) Else If $aResult[0] Then Return SetError($aResult[0], 0, 0) EndIf EndIf Return $aResult[2] EndFunc ;==>_GDIPlus_ImageClone Func _WinAPI_UpdateLayeredWindowEx($hWnd, $hBitmap, $iOpacity = 255, $fDelete = 0) Local $Ret, $tSIZE, $tPOINT, $tBLENDFUNCTION, $hDC, $hDestDC, $hDestSv $Ret = DllCall('user32.dll', 'hwnd', 'GetDC', 'hwnd', $hWnd) $hDC = $Ret[0] $Ret = DllCall('gdi32.dll', 'hwnd', 'CreateCompatibleDC', 'hwnd', $hDC) $hDestDC = $Ret[0] $Ret = DllCall('gdi32.dll', 'hwnd', 'SelectObject', 'hwnd', $hDestDC, 'ptr', $hBitmap) $hDestSv = $Ret[0] $tSIZE = _WinAPI_GetBitmapDimension($hBitmap) $tPOINT = DllStructCreate($tagPOINT) $tBLENDFUNCTION = DllStructCreate($tagBLENDFUNCTION) DllStructSetData($tBLENDFUNCTION, 'Alpha', $iOpacity) DllStructSetData($tBLENDFUNCTION, 'Format', 1) $Ret = DllCall('user32.dll', 'int', 'UpdateLayeredWindow', 'hwnd', $hWnd, 'hwnd', $hDC, 'ptr', 0, 'ptr', DllStructGetPtr($tSIZE), 'hwnd', $hDestDC, 'ptr', DllStructGetPtr($tPOINT), 'dword', 0, 'ptr', DllStructGetPtr($tBLENDFUNCTION), 'dword', 0x02) DllCall('user32.dll', 'int', 'ReleaseDC', 'hwnd', $hWnd, 'hwnd', $hDC) DllCall('gdi32.dll', 'ptr', 'SelectObject', 'hwnd', $hDestDC, 'ptr', $hDestSv) DllCall('gdi32.dll', 'int', 'DeleteDC', 'hwnd', $hDestDC) If Not $Ret[0] Then Return SetError(1, 0, 0) EndIf If $fDelete Then _WinAPI_DeleteObject($hBitmap) EndIf Return 1 EndFunc ;==>_WinAPI_UpdateLayeredWindowEx Func _LoadTick() $tick_back_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_back.png') $tick_hi = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_hi.png') $tick_wi = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_wi.png') $tick1_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_1.png') $tick2_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_2.png') $bu1_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\bu_1.png') $bu2_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\bu_2.png') EndFunc ;==>_LoadTick Func _GDIPlus_ImageRotateAtCenterEllipse($hImage, $fAngle, $iW = 211, $iH = 211); coded by UEZ Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $iW / 2, $iH / 2) _GDIPlus_MatrixRotate($hMatrix, $fAngle) _GDIPlus_GraphicsSetTransform($hCtxt, $hMatrix) _GDIPlus_GraphicsDrawImage($hCtxt, $hImage, -$iW / 2, -$iH / 2) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_GraphicsDispose($hCtxt) Local $hTexture = _GDIPlus_TextureCreate($hBitmap) _GDIPlus_BitmapDispose($hBitmap) $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsFillEllipse($hCtxt, 0, 0, $iW, $iH, $hTexture) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BrushDispose($hTexture) _GDIPlus_GraphicsDispose($hCtxt) Return $hBitmap EndFunc ;==>_GDIPlus_ImageRotateAtCenterEllipseJust press left mouse buttom over dial buttom and move mouse to the left or right.Br,UEZEdit: added suggestion from post#18 Edited August 25, 2013 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
wakillon Posted August 24, 2013 Share Posted August 24, 2013 @UEZ Tested and approved ! Thanks. AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
UEZ Posted August 24, 2013 Share Posted August 24, 2013 @UEZ Tested and approved ! Thanks. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
jaberwacky Posted August 24, 2013 Share Posted August 24, 2013 This doesn't show anything for me on Win7 x64 with 3.3.9.18. I press alt+f5 to run and nothing appears. I press f5 just for kicks and the comparison code at the top doesn't run either. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
UEZ Posted August 24, 2013 Share Posted August 24, 2013 Sounds like that the images are not loaded.Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
wakillon Posted August 24, 2013 Share Posted August 24, 2013 (edited) This doesn't show anything for me on Win7 x64 with 3.3.9.18. I press alt+f5 to run and nothing appears. I press f5 just for kicks and the comparison code at the top doesn't run either. Do you download png files ? (link at the top of first post) All is fine on win 7x64 with 3.3.9.18 Edited August 24, 2013 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
jaberwacky Posted August 24, 2013 Share Posted August 24, 2013 I just now remembered that I did not run the actual original script. I only watched the video! Sorry. Thanks! Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
davidkim Posted August 24, 2013 Author Share Posted August 24, 2013 (edited) @davidkim: Then try this: expandcollapse popup#region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=C:\AutoIt3\Aut2Exe\Icons\SETUP09.ICO #AutoIt3Wrapper_UseX64=n #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <GUIConstantsEx.au3> If @AutoItVersion < "3.3.9.18" Then Exit MsgBox(16, "Error", "AutoIt version 3.3.9.18 or higher needed!") ;~ Global Const $tagBITMAP = 'long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;' Global Const $SC_DRAGMOVE = 0xF012 Global $tick_back_png, $tick_hi, $tick_wi, $tick1_png, $tick2_png, $bu1_png, $bu2_png Global $tick = 295, $button = 0, $fDegree = 0, $iPrev = 0, $iSpeed = 2 Global $tx3 = 430 Global $y3 Global $bx3 Global $by3 = 341 Global $fDragging = False HotKeySet("{ESC}", '_exit_') _GDIPlus_Startup() _LoadTick() $tick_back_form = GUICreate('', 591, 395, -1, -1, $WS_POPUP, $WS_EX_LAYERED) $label = GUICtrlCreateLabel("", 103, 118, 211, 211) GUISetState() Global $hImage_Btn = _GDIPlus_BitmapCreateFromScan0(211, 211) Global $hCtxt_Btn = _GDIPlus_ImageGetGraphicsContext($hImage_Btn) _GDIPlus_GraphicsDrawImageRectRect($hCtxt_Btn, $tick_back_png, 103, 118, 211, 211, 0, 0, 211, 211) _GDIPlus_ImageDispose($hCtxt_Btn) setpng_back($tick_back_png, 0, 0, $fDegree) $tick_form = GUICreate("", 54, 55, 430, 295, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $tick_back_form) GUISetState() setpng_tick($tick_form, $tick1_png) $button_form = GUICreate('', 54, 55, 50, 341, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $tick_back_form) GUISetState() setpng_tick($button_form, $bu1_png) ; if form movement size display/move limit GUIRegisterMsg($WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING") ;~ $SPI_GETDRAGFULLWINDOWS = 38 ;~ $SPI_SETDRAGFULLWINDOWS = 37 Global $result = DllStructCreate("int"), $aCtrl ; system value backup DllCall("User32.dll", "int", "SystemParametersInfo", "int", 38, "int", 0, "ptr", DllStructGetPtr($result), "int", 0) ;windows move / mouse down and drag set value DllCall("User32.dll", "int", "SystemParametersInfo", "int", 37, "int", 1, "ptr", 0, "int", 0) While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $tick_back_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN $fDragging = False ;no tick/button to $WM_WINDOWPOSCHANGING $aCtrl = GUIGetCursorInfo($aMsg[1]) Switch $aCtrl[4] Case $label $iPrev = $aCtrl[0] Do $aCtrl = GUIGetCursorInfo($aMsg[1]) If $iPrev > $aCtrl[0] Then $fDegree -= $iSpeed $iPrev = $aCtrl[0] EndIf If $iPrev < $aCtrl[0] Then $fDegree += $iSpeed $iPrev = $aCtrl[0] EndIf setpng_back($tick_back_png, 0, 0, $fDegree) Until Not $aCtrl[2] * Sleep(10) Case Else _SendMessage($tick_back_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ;move can EndSwitch EndSwitch Case $tick_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN setpng_tick($tick_form, $tick2_png) ; Lamp ON $fDragging = True ; yes tick/button to $WM_WINDOWPOSCHANGING $pos = WinGetPos($tick_back_form, '') $tpos = WinGetPos($tick_form, '') $y3 = $tpos[1] - $pos[1] _SendMessage($tick_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) ; move can Case $GUI_EVENT_PRIMARYUP setpng_tick($tick_form, $tick1_png) ; Lamp OFF $fDragging = False EndSwitch Case $button_form Switch $aMsg[0] Case $GUI_EVENT_PRIMARYDOWN setpng_tick($button_form, $bu2_png) ; Lamp ON $fDragging = True ; yes tick/button to $WM_WINDOWPOSCHANGING $pos = WinGetPos($tick_back_form, '') $bpos = WinGetPos($button_form) $bx3 = $bpos[0] - $pos[0] _SendMessage($button_form, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) Case $GUI_EVENT_PRIMARYUP setpng_tick($button_form, $bu1_png); Lamp OFF $fDragging = False EndSwitch EndSwitch WEnd Func _exit_() DllCall("User32.dll", "int", "SystemParametersInfo", "int", 37, "int", DllStructGetData($result, 1), "ptr", 0, "int", 0) _GDIPlus_BitmapDispose($hImage_Btn) _GDIPlus_Shutdown() Exit EndFunc ;==>_exit_ Func WM_WINDOWPOSCHANGING($hWnd, $Msg, $wParam, $lParam) If $hWnd = $tick_form And $fDragging = True Then ; move tick $pos = WinGetPos($tick_back_form, '') $tpos = WinGetPos($tick_form) Local $iY = $tpos[1] ; now Y Pos Local $iY_Min = $pos[1] + 90 ; y min Local $iY_Max = $pos[1] + 300 ; y max Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $NowPosition = $pos[0] + $tx3 Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) setpng_back($tick_back_png, 210 - ($iY_Max - $iY), 1, $fDegree) ; move area calc $tick = 210 - ($iY_Max - $iY) ; Last Position Store If $iTop < $iY_Min Then DllStructSetData($stWinPos, 4, $iY_Min) If $iTop > $iY_Max Then DllStructSetData($stWinPos, 4, $iY_Max) If $iLeft <> $NowPosition Then DllStructSetData($stWinPos, 3, $pos[0] + $tx3) ; x position fixed EndIf If $hWnd = $button_form And $fDragging = True Then $pos = WinGetPos($tick_back_form, '') $bpos = WinGetPos($button_form) Local $iX = $bpos[0] ; now X Pos Local $iX_Min = $pos[0] + 50 ; x min Local $iX_Max = $pos[0] + 481 ; x max Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $NowPosition = $pos[1] + $by3 Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) $button = 451 - ($iX_Max - $iX) ; Last Position Store ;~ Local $fAngle = 180 * (-20 + $button) / 431 - 123 setpng_back($tick_back_png, 451 - ($iX_Max - $iX), 2, $fDegree) ; move area calc If $iLeft < $iX_Min Then DllStructSetData($stWinPos, 3, $iX_Min) If $iLeft > $iX_Max Then DllStructSetData($stWinPos, 3, $iX_Max) If $iTop <> $NowPosition Then DllStructSetData($stWinPos, 4, $pos[1] + $by3) ; y position fixed EndIf EndFunc ;==>WM_WINDOWPOSCHANGING Func setpng_back($png, $hper, $mode = 0, $fAngle = 0) If $fAngle < -123 Then $fAngle = -123 If $fAngle > 57 Then $fAngle = 57 Local $graph, $hImage, $hHBitmap $hImage = _GDIPlus_ImageClone($png) $graph = _GDIPlus_ImageGetGraphicsContext($hImage) ; create memory blank area If $mode = 2 Then Set_Progress_W($graph, $hper, $tick_wi) Set_Progress_H($graph, $tick, $tick_hi) EndIf If $mode = 1 Then Set_Progress_H($graph, $hper, $tick_hi) Set_Progress_W($graph, $button, $tick_wi) EndIf Local $hBmp_BG = _GDIPlus_ImageRotateAtCenterEllipse($hImage_Btn, $fAngle) ;-123 to 57 _GDIPlus_GraphicsDrawImageRectRect($graph, $hBmp_BG, 0, 0, 211, 211, 103, 118, 211, 211) _GDIPlus_BitmapDispose($hBmp_BG) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_UpdateLayeredWindowEx($tick_back_form, $hHBitmap, 255, 1) _GDIPlus_GraphicsSetSmoothingMode($graph, 4) _GDIPlus_GraphicsDispose($graph) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hHBitmap) EndFunc ;==>setpng_back Func Set_Progress_W($graph, $ct, $png) _GDIPlus_GraphicsDrawImageRectRect($graph, $png, _ 0, 0, $ct, 12, _ 70, 355, $ct, 12) EndFunc ;==>Set_Progress_W Func Set_Progress_H($graph, $ct, $png) _GDIPlus_GraphicsDrawImageRectRect($graph, $png, _ 0, $ct, 12, 240 - $ct, _ 450, $ct + 95, 12, 240 - $ct) EndFunc ;==>Set_Progress_H Func setpng_tick($hForm, $png) Local $graph, $hImage, $hHBitmap $hImage = _GDIPlus_ImageClone($png) $graph = _GDIPlus_ImageGetGraphicsContext($hImage) $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_UpdateLayeredWindowEx($hForm, $hHBitmap, 255, 1) _GDIPlus_GraphicsSetSmoothingMode($graph, 4) _GDIPlus_GraphicsDispose($graph) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hHBitmap) EndFunc ;==>setpng_tick Func _GDIPlus_ImageClone($hImage) Local $aResult = DllCall($ghGDIPDll, 'uint', 'GdipCloneImage', 'ptr', $hImage, 'ptr*', 0) If @error Then Return SetError(1, 0, 0) Else If $aResult[0] Then Return SetError($aResult[0], 0, 0) EndIf EndIf Return $aResult[2] EndFunc ;==>_GDIPlus_ImageClone Func _WinAPI_UpdateLayeredWindowEx($hWnd, $hBitmap, $iOpacity = 255, $fDelete = 0) Local $Ret, $tSIZE, $tPOINT, $tBLENDFUNCTION, $hDC, $hDestDC, $hDestSv $Ret = DllCall('user32.dll', 'hwnd', 'GetDC', 'hwnd', $hWnd) $hDC = $Ret[0] $Ret = DllCall('gdi32.dll', 'hwnd', 'CreateCompatibleDC', 'hwnd', $hDC) $hDestDC = $Ret[0] $Ret = DllCall('gdi32.dll', 'hwnd', 'SelectObject', 'hwnd', $hDestDC, 'ptr', $hBitmap) $hDestSv = $Ret[0] $tSIZE = _WinAPI_GetBitmapDimension($hBitmap) $tPOINT = DllStructCreate($tagPOINT) $tBLENDFUNCTION = DllStructCreate($tagBLENDFUNCTION) DllStructSetData($tBLENDFUNCTION, 'Alpha', $iOpacity) DllStructSetData($tBLENDFUNCTION, 'Format', 1) $Ret = DllCall('user32.dll', 'int', 'UpdateLayeredWindow', 'hwnd', $hWnd, 'hwnd', $hDC, 'ptr', 0, 'ptr', DllStructGetPtr($tSIZE), 'hwnd', $hDestDC, 'ptr', DllStructGetPtr($tPOINT), 'dword', 0, 'ptr', DllStructGetPtr($tBLENDFUNCTION), 'dword', 0x02) DllCall('user32.dll', 'int', 'ReleaseDC', 'hwnd', $hWnd, 'hwnd', $hDC) DllCall('gdi32.dll', 'ptr', 'SelectObject', 'hwnd', $hDestDC, 'ptr', $hDestSv) DllCall('gdi32.dll', 'int', 'DeleteDC', 'hwnd', $hDestDC) If Not $Ret[0] Then Return SetError(1, 0, 0) EndIf If $fDelete Then _WinAPI_DeleteObject($hBitmap) EndIf Return 1 EndFunc ;==>_WinAPI_UpdateLayeredWindowEx Func _LoadTick() $tick_back_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_back.png') $tick_hi = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_hi.png') $tick_wi = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_wi.png') $tick1_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_1.png') $tick2_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\tick_2.png') $bu1_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\bu_1.png') $bu2_png = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\bu_2.png') EndFunc ;==>_LoadTick Func _GDIPlus_ImageRotateAtCenterEllipse($hImage, $fAngle, $iW = 211, $iH = 211); coded by UEZ Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) Local $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $iW / 2, $iH / 2) _GDIPlus_MatrixRotate($hMatrix, $fAngle) _GDIPlus_GraphicsSetTransform($hCtxt, $hMatrix) _GDIPlus_GraphicsDrawImage($hCtxt, $hImage, -$iW / 2, -$iH / 2) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_GraphicsDispose($hCtxt) Local $hTexture = _GDIPlus_TextureCreate($hBitmap) _GDIPlus_BitmapDispose($hBitmap) $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsFillEllipse($hCtxt, 0, 0, $iW, $iH, $hTexture) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BrushDispose($hTexture) _GDIPlus_GraphicsDispose($hCtxt) Return $hBitmap EndFunc ;==>_GDIPlus_ImageRotateAtCenterEllipse Just press left mouse buttom over dial buttom and move mouse to the left or right. Br, UEZ Thank UEZ. Round the dial button and drag to rotateI want to run smoothly. drag round dial turn action to backup is $mode = 3 set.. setpng_back($tick_back_png, 0, 3, $fDegree) Func setpng_back($png, $hper, $mode = 0, $fAngle = 0) If $fAngle < -123 Then $fAngle = -123 If $fAngle > 57 Then $fAngle = 57 Local $graph, $hImage, $hHBitmap $hImage = _GDIPlus_ImageClone($png) $graph = _GDIPlus_ImageGetGraphicsContext($hImage) ; create memory blank area If $mode = 3 Then Set_Progress_H($graph, $tick, $tick_hi) Set_Progress_W($graph, $button, $tick_wi) EndIf If $mode = 2 Then Set_Progress_W($graph, $hper, $tick_wi) Set_Progress_H($graph, $tick, $tick_hi) EndIf If $mode = 1 Then Set_Progress_H($graph, $hper, $tick_hi) Set_Progress_W($graph, $button, $tick_wi) EndIf Edited August 24, 2013 by davidkim I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now