careca Posted June 20, 2020 Share Posted June 20, 2020 Hi, im trying to do a gui resize and move some controls on the press of a button, the issue is that when i use the function _GuiRoundCorners, that is self explanatory, the window no longer resizes properly, if i comment the line that calls the function, it works fine. So the question is: Is there any way to keep the resizing of the window, while having round corners in the gui? Reproducible: expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoIt3Wrapper_Icon=.ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Comment=By: ;#AutoIt3Wrapper_Res_Description= #AutoIt3Wrapper_Res_Fileversion=1.0 #AutoIt3Wrapper_Res_SaveSource=y ;#AutoIt3Wrapper_Res_Icon_Add=.ico #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;============================================================================= #Region ;Include + Opt #include <File.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <TrayConstants.au3> Opt("TrayMenuMode", 3) Opt("TrayIconHide", 0) Opt("GUIResizeMode", 1) Opt("TrayIconDebug", 1) Opt("TrayAutoPause", 0) Opt("MouseCoordMode", 2) Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 0) Opt("GUIEventOptions", 1) Opt("TrayOnEventMode", 0) Opt("ExpandEnvStrings", 1) Opt("WinDetectHiddenText", 1) #EndRegion ;Include + Opt ;============================================================================= #Region ;GuiVars Local $GUI, $Frm_main, $Button_1 ;TrayVars Local $PLTray, $PSTray, $STTray, $NTray, $PTray, $CTTray, $ExitItem ;MiscVars Local $Au3filesArray, $Msg, $txt, $Reg, $RegTrim, $WideM = 0, $WinCoords #EndRegion ;GuiVars ;============================================================================= #Region ;GUI TraySetIcon("ico.ico") $GUI = GUICreate('Au3', 150, 100, 100, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Restore") $ExitItem = TrayCreateItem("Close") TrayItemSetOnEvent(-1, "Quit") GUISetState() TraySetState(1) TraySetClick(8) ;============================================================================= Local $ButtonWide = GUICtrlCreateButton('', 120, 20, 7, 50) GUICtrlSetTip($ButtonWide, 'Wide mode makes the player wider and moves the controls accordingly', "Tip", 1) GUICtrlSetOnEvent($ButtonWide, "WideMode") GUICtrlSetBkColor($ButtonWide, '0x000000') ;============================================================================= Global $i_x1 = 0, $i_y1 = 0, $i_x3 = 15, $i_y3 = 15 _GuiRoundCorners($GUI, $i_x1, $i_y1, $i_x3, $i_y3) ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #EndRegion ;GUI ;============================================================================= Do ;Main Sleep(100) Until GUIGetMsg() = $GUI_EVENT_CLOSE ;============================================================================= Func WideMode() $WinCoords = WinGetPos($GUI) If $WideM = 0 Then WinMove($GUI, '', $WinCoords[0], $WinCoords[1], 605, $WinCoords[3]) GUICtrlSetPos($ButtonWide, 575, 20, 7, 50) $WideM = 1 Else WinMove($GUI, '', $WinCoords[0], $WinCoords[1], 150, $WinCoords[3]) GUICtrlSetPos($ButtonWide, 120, 20, 7, 50) $WideM = 0 EndIf EndFunc ;==>WideMode ;============================================================================= Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) Local $pos, $ret, $ret2 $pos = WinGetPos($h_win) If IsArray($pos) Then $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3) If $ret[0] Then $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1) If $ret2[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf Return 0 EndIf EndFunc ;==>_GuiRoundCorners ;============================================================================= #Region ;Window Func Minimize() WinSetState('', '', @SW_MINIMIZE) EndFunc ;==>Minimize Func Restore() WinSetState('', '', @SW_RESTORE) EndFunc ;==>Restore Func Quit() Exit EndFunc ;==>Quit #EndRegion ;Window ;============================================================================= Thanks in advance. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
AutoBert Posted June 20, 2020 Share Posted June 20, 2020 Change: Func WideMode() $WinCoords = WinGetPos($GUI) If $WideM = 0 Then WinMove($GUI, '', $WinCoords[0], $WinCoords[1], 605, $WinCoords[3]) GUICtrlSetPos($ButtonWide, 575, 20, 7, 50) $WideM = 1 Else WinMove($GUI, '', $WinCoords[0], $WinCoords[1], 150, $WinCoords[3]) GUICtrlSetPos($ButtonWide, 120, 20, 7, 50) $WideM = 0 EndIf _GuiRoundCorners($GUI, $i_x1, $i_y1, $i_x3, $i_y3) ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< EndFunc ;==>WideMode and it works. Maybe other ways to start a repaint of the Gui are also possible. careca 1 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