stefionesco Posted August 17, 2017 Posted August 17, 2017 Hi there. I make a GUI that works just fine. I try to improve only the aesthetic side, adding a background image, but I can't do it "under" the radio buttons. If I use a colour it's OK. Only with am image didn't work. It is possible to use some image as background or not? Here is my script: expandcollapse popup#include <GuiConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <file.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <FontConstants.au3> #include <ColorConstants.au3> Opt("GUIOnEventMode", 1) Global $mainwindow = GuiCreate("Background", 275, 200, 100, 100) GUICtrlCreatePic('background.jpg', 0, 0, 0, 0) GUICtrlSetState(-1, $GUI_DISABLE) Local $sFont = "Arial Black" GUISetFont(12, $FW_NORMAL, $sFont) GUISetIcon("icon.ico") Local $idRadio1 = GUICtrlCreateRadio("Radio 1", 10, 10, 255, 20) Local $idRadio2 = GUICtrlCreateRadio("Radio 2", 10, 40, 255, 20) Local $idRadio3 = GUICtrlCreateRadio("Radio 3", 10, 70, 255, 20) GUICtrlSetState($idRadio1, $GUI_CHECKED) Local $searchbutton = GUICtrlCreateButton("ACTION", 85, 110, 100, 30) GUICtrlSetOnEvent($searchbutton, "_action") GUISetOnEvent($GUI_EVENT_CLOSE, "_Terminate") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func _action() If GUICtrlRead($idRadio1) = $GUI_CHECKED Then MsgBox($MB_ICONINFORMATION, "Background", "1", 0) EndIf If GUICtrlRead($idRadio2) = $GUI_CHECKED Then MsgBox($MB_ICONINFORMATION, "Background", "2", 0) EndIf If GUICtrlRead($idRadio3) = $GUI_CHECKED Then MsgBox($MB_ICONINFORMATION, "Background", "3", 0) EndIf EndFunc Func _Terminate() Exit EndFunc Thanks. icon.ico
UEZ Posted August 17, 2017 Posted August 17, 2017 Try it this way: expandcollapse popup#include <GuiConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <file.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <FontConstants.au3> #include <ColorConstants.au3> Opt("GUIOnEventMode", 1) Global $mainwindow = GuiCreate("Background", 275, 200, 100, 100) GUICtrlCreatePic('background.jpg', 0, 0, 0, 0) GUICtrlSetState(-1, $GUI_DISABLE) Local $sFont = "Arial Black" GUISetFont(12, $FW_NORMAL, $sFont) GUISetIcon("icon.ico") Local $idRadio1 = GUICtrlCreateRadio("Radio 1", 10, 10, 255, 20) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Local $idRadio2 = GUICtrlCreateRadio("Radio 2", 10, 40, 255, 20) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Local $idRadio3 = GUICtrlCreateRadio("Radio 3", 10, 70, 255, 20) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetState($idRadio1, $GUI_CHECKED) Local $searchbutton = GUICtrlCreateButton("ACTION", 85, 110, 100, 30) GUICtrlSetOnEvent($searchbutton, "_action") GUISetOnEvent($GUI_EVENT_CLOSE, "_Terminate") DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($idRadio1), "wstr", 0, "wstr", 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($idRadio2), "wstr", 0, "wstr", 0) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($idRadio3), "wstr", 0, "wstr", 0) GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func _action() If GUICtrlRead($idRadio1) = $GUI_CHECKED Then MsgBox($MB_ICONINFORMATION, "Background", "1", 0) EndIf If GUICtrlRead($idRadio2) = $GUI_CHECKED Then MsgBox($MB_ICONINFORMATION, "Background", "2", 0) EndIf If GUICtrlRead($idRadio3) = $GUI_CHECKED Then MsgBox($MB_ICONINFORMATION, "Background", "3", 0) EndIf EndFunc Func _Terminate() Exit EndFunc 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
stefionesco Posted August 17, 2017 Author Posted August 17, 2017 i don't know what GUICtrlGetHandle do, but it looks good. I should study this one. Thanks. It works.
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