Steve0 Posted November 10, 2010 Share Posted November 10, 2010 (edited) I've posted on this before, and thought the problem was resolved, but it has reared its ugly head once again. I've a GUI with a number of images on it. These images are resized to double the size, then return back to normal size. Upon resize, I have been unable to find a way to ensure the specific image is "on top" of all the others. I've tried using the GUICtrlSetPos and CommandMove method, both resize correctly, but as you can see by the example, it does not show ontop of all others. I've put two methods in the example to resize the central image. I am at a loss as to what can be done to "bring to front" for the image when resized. expandcollapse popup#include <GUIConstantsEx.au3> $Form = GUICreate("GUI Order Example", 400, 300, 100,100) $Pic1 = GUICtrlCreatePic("C:\Program Files\AutoIT3\Examples\GUI\mslogo.jpg", 50, 50, 255, 40) $Pic2 = GUICtrlCreatePic("C:\Program Files\AutoIT3\Examples\GUI\mslogo.jpg", 50, 90, 255, 40) $Pic3 = GUICtrlCreatePic("C:\Program Files\AutoIT3\Examples\GUI\mslogo.jpg", 50, 130, 255, 40) $GUICtrlButton = GUICtrlCreateButton("GUICtrl Method", 60, 180, 80, 30) $CmdCtrlButton = GUICtrlCreateButton("CmdCtrl Method", 160, 180, 80, 30) $ResetGUIButton = GUICtrlCreateButton("Reset (Gui)", 60, 220, 80, 30) $ResetCmdButton = GUICtrlCreateButton("Reset (Cmd)", 160, 220, 80, 30) GUISetState(@SW_SHOW, $Form) While 1 $nMsg = GUIGetMsg($Form) Switch $nMsg Case $GUICtrlButton ; Move $Pic2 up and left by 1/4 of the dimensions so it remains central when size is doubled. ; Only reason for the formulas here is to show where the sizing came from. GUICtrlSetPos($Pic2, 50-(255/4), 90-(40/4), (255*2), (40*2)) Case $CmdCtrlButton ; Move $Pic2 up and left by 1/4 of the dimensions so it remains central when size is doubled. ; Only reason for the formulas here is to show where the sizing came from. ControlMove($Form, "", $Pic2, 50-(255/4), 90-(40/4), (255*2), (40*2)) Case $ResetGUIButton ; Reset $Pic2 back to original size GUICtrlSetPos($Pic2, 50, 90, 255, 40) Case $ResetCmdButton ; Reset $Pic2 back to original size ControlMove($Form, "", $Pic2, 50, 90, 255, 40) Case $GUI_EVENT_CLOSE Exit EndSwitch Wend I cant see anything in WinApi to work with a specific control and disabling the image does not make a difference. Any other suggestions aside from deleting and recreating the image when selected? This causes an unwanted 'flash' when its deleted and recreated. My apologies for including direct links to example files. Thanks in advance Steve Edited November 10, 2010 by Steve0 Link to comment Share on other sites More sharing options...
martin Posted November 10, 2010 Share Posted November 10, 2010 One way you could try is setting the style of pics that are to be covered to $WS_CLIPSIBLINGS. Case $GUICtrlButton ; Move $Pic2 up and left by 1/4 of the dimensions so it remains central when size is doubled. ; Only reason for the formulas here is to show where the sizing came from. $style = _Winapi_getwindowlong(GUICtrlGetHandle($Pic3),$GWL_STYLE);needs winapi.au3 and constants.au3 _Winapi_setwindowlong(GUICtrlGetHandle($Pic3),$GWL_STYLE,Bitand($style,$WS_CLIPSIBLINGS)) GUICtrlSetPos($Pic2, 50-(255/4), 90-(40/4), (255*2), (40*2)) But you would need to reset the style each time and maybe ensure the pic is redrawn after resetting the sizes. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
martin Posted November 10, 2010 Share Posted November 10, 2010 (edited) Perhaps a better way is Case $GUICtrlButton ; Move $Pic2 up and left by 1/4 of the dimensions so it remains central when size is doubled. ; Only reason for the formulas here is to show where the sizing came from. $iFlags = BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE) _WinAPI_SetWindowPos(GUICtrlGetHandle($pic2) , $HWND_BOTTOM, 0, 0, 0, 0, $iFlags) GUICtrlSetPos($Pic2, 50-(255/4), 90-(40/4), (255*2), (40*2)) Edited November 10, 2010 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Steve0 Posted November 11, 2010 Author Share Posted November 11, 2010 Simply marvellous. Many thanks for your quick responses, very much appreciated!! Steve 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