Resize and reposition the GUI controls when the user drags the $DragBar.
the $DragBar is invisible, move the mouse between $List1 and $Edit1 and you will see the change in the cursor, then you can do it
; https://www.autoitscript.com/forum/topic/212020-drag-adjust/
;----------------------------------------------------------------------------------------
; Title...........: _DragAdjust.au3
; Description.....: Resize and reposition the GUI controls when the user drags the $DragBar.
; AutoIt Version..: 3.3.16.1 Author: ioa747
; Note............: Testet in Win10 22H2
;----------------------------------------------------------------------------------------
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ComboConstants.au3>
#include <WinAPIGdi.au3>
Global $iGuiW = 600, $iMargin = 4
Global $hGUI = GUICreate("Form1", $iGuiW, 315, 205, 130)
Global $Combo1 = GUICtrlCreateCombo("Combo1", $iMargin, $iMargin, 196, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
Global $List1 = GUICtrlCreateList("", $iMargin, 30, 196, 285)
Global $Edit1 = GUICtrlCreateEdit("Edit1", 204, $iMargin, 392, 305)
Global $DragBar = GUICtrlCreateLabel("", 200, 0, $iMargin, 315, $SS_CENTERIMAGE, $WS_EX_LAYERED)
GUICtrlSetCursor(-1, 13)
GUISetState(@SW_SHOW)
;**********************************
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
_DragAdjust()
Sleep(10)
WEnd
;**********************************
Func _DragAdjust()
Local Static $iOffset = $iMargin / 2
If Not WinActive($hGUI) Then Return SetError(1, 0, False)
Local $ActiveCtrl
Local $aCtrl = GUIGetCursorInfo($hGUI)
$ActiveCtrl = IsArray($aCtrl) ? $aCtrl[4] : 0
If $ActiveCtrl = $DragBar Then
Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client
If $aCtrl[2] = 1 Then ;Primary down
While $aCtrl[2]
$aCtrl = GUIGetCursorInfo($hGUI)
Local $iMp = MouseGetPos(0) < $iMargin ? $iMargin : MouseGetPos(0) > ($iGuiW - $iMargin) ? $iGuiW - $iMargin : MouseGetPos(0)
GUICtrlSetPos($DragBar, $iMp - $iOffset)
GUICtrlSetPos($Combo1, $iMargin, Default, $iMp - $iMargin - $iOffset)
GUICtrlSetPos($List1, $iMargin, Default, $iMp - $iMargin - $iOffset)
GUICtrlSetPos($Edit1, $iMp + $iOffset, Default, $iGuiW - $iMp - $iMargin - $iOffset)
Sleep(10)
WEnd
_WinAPI_RedrawWindow($hGUI)
EndIf
Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client
EndIf
EndFunc ;==>_DragAdjust
Please, every comment is appreciated!
leave your comments and experiences here!
Thank you very much