How do you first clear an image without resizing the control (as a function)?
I'm not sure if this is a bug but if you compare clearing as a function vs as a global? it works differently?
I need to clear the image first as sometimes no image file is found
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ColorConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$hMain = GUICreate("Test", -1, 300, -1, -1, BitOr($WS_SIZEBOX, $WS_SYSMENU, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX), $WS_EX_ACCEPTFILES)
$btn = GUICtrlCreateButton("Change", 120, 80, 75, 20, $BS_DEFPUSHBUTTON)
$picUser = GUICtrlCreatePic("", 270, 10, 100, 80)
$sImage = "C:\Windows\Web\Screen\img100.jpg"
GUICtrlSetImage($picUser,""); - can be left alone without resizing control
$sImage = "C:\Windows\Web\Screen\img104.jpg"
GUICtrlSetImage($picUser, $sImage)
GUISetState(@SW_SHOW)
While True
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
Exit
Case $nMsg = $btn
ButtonPressed("C:\Windows\Web\Screen\img102.jpg")
EndSelect
WEnd
Func ButtonPressed($imagelocation)
;GUICtrlSetImage($picUser,""); - don't comment out - it will clear picture but resize control
GUICtrlSetImage($picUser, $imagelocation)
EndFunc