scila1996 Posted February 17, 2014 Share Posted February 17, 2014 Hi everyone I have one simple button GUIDE like this Image. how to create one like this GUIDE. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 17, 2014 Moderators Share Posted February 17, 2014 scila1996,In much the same way as the code I posted in your last thread: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> Opt("GuiOnEventMode", 1) Global $fHover = False $hGUI = GUICreate("AForm1", 200, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $cLabel = GUICtrlCreateLabel("Button", 80, 80, 40, 40, BitOr($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetOnEvent($cLabel, "_Pressed") GUICtrlSetBkColor($cLabel, 0xFFFFFF) GUISetState() While 1 Sleep(10) $aCInfo = GUIGetCursorInfo($hGUI) If $aCInfo[4] = $cLabel And $fHover = False Then $fHover = True GUICtrlSetBkColor($cLabel, 0xCCCCFF) ElseIf $aCInfo[4] <> $cLabel And $fHover = True Then $fHover = False GUICtrlSetBkColor($cLabel, 0xFFFFFF) EndIf WEnd Func _Pressed() MsgBox($MB_SYSTEMMODAL, "Hi", "Pressed") EndFunc Func _Exit() Exit EndFuncM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
scila1996 Posted February 19, 2014 Author Share Posted February 19, 2014 (edited) Thank M23 ! I have one small problem I created the following 1 GUILD When you move your mouse on the Run icon (shell32.dll, 25) ---> Let's make this icon does not border the outside and white instead of blue background labels remove white space around the logo Run #include <GUIConstants.au3> Opt("GuiOnEventMode", 1) Global $l2 Global $taomoi = False $Form1 = GUICreate("AForm1", 308, 193, 193, 115) Global $testmau = GUICtrlCreateLabel("", 40, 80, 123, 50) Global $Label2 = GUICtrlCreateLabel("Tray", 88, 85, 43, 50) Global $Icon1 = GUICtrlCreateIcon("shell32.dll", 25, 48, 85, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP)) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") While 1 Sleep(10) $aCInfo = GUIGetCursorInfo($Form1) If $aCInfo[4] = $Icon1 And $taomoi = False Then $taomoi = True GUICtrlSetStyle($testmau, $WS_BORDER, "") GUICtrlSetBkColor($testmau ,0x24DBD1) GUICtrlSetBkColor($Icon1, 0x24DBD1) GUICtrlSetBkColor($Label2, 0x24DBD1) ElseIf $aCInfo[4] <> $Icon1 And $taomoi = True Then $taomoi = False GUICtrlSetStyle($testmau, "", "") GUICtrlSetBkColor($testmau , Default) GUICtrlSetBkColor($Icon1, Default) GUICtrlSetBkColor($Label2, Default) EndIf WEnd Func _Exit() Exit EndFunc Edited February 19, 2014 by scila1996 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 19, 2014 Moderators Share Posted February 19, 2014 scila1996,Just make the $Label2 fit within $testmau - and if you set its background as transparent then you remove the need to colour it all: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GuiOnEventMode", 1) Global $taomoi = False $Form1 = GUICreate("AForm1", 308, 193, 193, 115) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Global $testmau = GUICtrlCreateLabel("", 40, 80, 123, 45) Global $Label2 = GUICtrlCreateLabel("Tray", 88, 85, 43, 30) ; <<<<<<<<<<<<<<<<<<<<<< GUICtrlSetBkColor($Label2, $GUI_BKCOLOR_TRANSPARENT) ; <<<<<<<<<<<<<<<<<<<<<< Global $Icon1 = GUICtrlCreateIcon("shell32.dll", 25, 48, 85, 32, 32) GUISetState(@SW_SHOW) While 1 Sleep(10) $aCInfo = GUIGetCursorInfo($Form1) If $aCInfo[4] = $Icon1 And $taomoi = False Then $taomoi = True GUICtrlSetStyle($testmau, $WS_BORDER, "") GUICtrlSetBkColor($testmau ,0x24DBD1) ElseIf $aCInfo[4] <> $Icon1 And $taomoi = True Then $taomoi = False GUICtrlSetStyle($testmau, "", "") GUICtrlSetBkColor($testmau , Default) EndIf WEnd Func _Exit() Exit EndFuncBut I have no idea how to make the icon background transparent - and you cannot set the colour using GUICtrlSetBkColor. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
scila1996 Posted February 19, 2014 Author Share Posted February 19, 2014 (edited) Please do bother you a little bit more How to Create ... Edited February 19, 2014 by scila1996 Link to comment Share on other sites More sharing options...
FireFox Posted February 19, 2014 Share Posted February 19, 2014 (edited) Hi, AFAIK, the GUICtrlCreateIcon does not handle transparency. You can use the Icons UDF associated with CreatePic, which does the trick : expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Icons.au3> ;http://www.autoitscript.com/forum/topic/92675-icons-udf/ Opt("GuiOnEventMode", 1) Global $taomoi = False $Form1 = GUICreate("AForm1", 308, 193, 193, 115) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Global $testmau = GUICtrlCreateLabel("", 40, 80, 123, 45) Global $Label2 = GUICtrlCreateLabel("Tray", 88, 85, 43, 30) ; <<<<<<<<<<<<<<<<<<<<<< GUICtrlSetBkColor($Label2, $GUI_BKCOLOR_TRANSPARENT) ; <<<<<<<<<<<<<<<<<<<<<< ;Global $Icon1 = GUICtrlCreateIcon("shell32.dll", 25, 48, 85, 32, 32) Global $Icon1 = GUICtrlCreatePic('', 48, 85, 32, 32) $hIcon = _Icons_Icon_Extract(@SystemDir & '\shell32.dll', 25 - 1, 32, 32) $hBitmap = _Icons_Bitmap_CreateFromIcon($hIcon) _SetHImage($Icon1, $hBitmap) _WinAPI_DeleteObject($hBitmap) _WinAPI_DestroyIcon($hIcon) GUISetState(@SW_SHOW) While 1 Sleep(10) $aCInfo = GUIGetCursorInfo($Form1) If $aCInfo[4] = $Icon1 And $taomoi = False Then $taomoi = True GUICtrlSetStyle($testmau, $WS_BORDER, "") GUICtrlSetBkColor($testmau, 0x24DBD1) ElseIf $aCInfo[4] <> $Icon1 And $taomoi = True Then $taomoi = False GUICtrlSetStyle($testmau, "", "") GUICtrlSetBkColor($testmau, Default) EndIf WEnd Func _Exit() Exit EndFunc ;==>_Exit _ Br, FireFox. Edited February 19, 2014 by FireFox Link to comment Share on other sites More sharing options...
scila1996 Posted February 19, 2014 Author Share Posted February 19, 2014 thank you ff It is perfect and to my liking Can you help me create buttons and icons are not shown in Figure Link to comment Share on other sites More sharing options...
FireFox Posted February 19, 2014 Share Posted February 19, 2014 It's almost the same button as before, can you show us what you've tried so far ? Link to comment Share on other sites More sharing options...
scila1996 Posted February 19, 2014 Author Share Posted February 19, 2014 It's almost the same button as before, can you show us what you've tried so far ? Link to comment Share on other sites More sharing options...
FireFox Posted February 19, 2014 Share Posted February 19, 2014 You are not answering my question Link to comment Share on other sites More sharing options...
scila1996 Posted February 19, 2014 Author Share Posted February 19, 2014 Sorry FF I want to create buttons and icons included in this document as Link to comment Share on other sites More sharing options...
FireFox Posted February 19, 2014 Share Posted February 19, 2014 Then _GUICtrlButton_SetImage is what you need Br, FireFox. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 19, 2014 Moderators Share Posted February 19, 2014 scila1996,And here is an example of how it is used: expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <GuiImageList.au3> _Main() Func _Main() Local $sAutoIt_Path = StringReplace(@AutoItExe, "AutoIt3.exe", "") ConsoleWrite($sAutoIt_Path & @CRLF) Local $sGreen = $sAutoIt_Path & "Examples\GUI\Advanced\Images\Green.bmp" Local $sBlue = $sAutoIt_Path & "Examples\GUI\Advanced\Images\Blue.bmp" Local $sRed = $sAutoIt_Path & "Examples\GUI\Advanced\Images\Red.bmp" Local $sIcon1 = $sAutoIt_Path & "Icons\au3.ico" Local $sIcon2 = $sAutoIt_Path & "Icons\au3script_v10.ico" Local $btn1, $btn2, $btn3, $btn4, $msg Local $hImagebtn1, $hImagebtn2, $hImagebtn3, $hImagebtn4 Local $label1 ;Caveat: Minimum Operating Systems: Windows XP Local $hGUI = GUICreate("Button Imagelists", 500, 300) $label1 = GUICtrlCreateLabel("", 150, 30, 340, 250) GUICtrlSetFont(-1, 12) $msg = "The 'Changer' button shows what can be done. " & @CRLF $msg &= "It displays Blue normally," & @CRLF $msg &= "but changes to Red when the cursor is over it. " & @CRLF $msg &= "Pressing changes it to Green." & @CRLF $msg &= "When disabled it shows Red, " & @CRLF $msg &= "and when focused (use the Tab key)" & @CRLF $msg &= "it switches between 2 icons." GUICtrlSetData($label1, $msg) ;multi state image Bitmap $btn1 = GUICtrlCreateButton("Changer", 30, 30, 90, 32) GUICtrlSetTip(-1, "Multi state bitmap imagelist") $hImagebtn1 = _GUIImageList_Create(24, 24, 5, 5) _GUIImageList_AddBitmap($hImagebtn1, $sBlue) ;1 - Normal _GUIImageList_AddBitmap($hImagebtn1, $sRed) ;2 - Hot _GUIImageList_AddBitmap($hImagebtn1, $sGreen) ;3 - Pressed _GUIImageList_AddBitmap($hImagebtn1, $sRed) ;4 - Disabled _GUIImageList_AddIcon($hImagebtn1, $sIcon1) ;5 - Focus Switch - possibly Vista only for the switch _GUIImageList_AddIcon($hImagebtn1, $sIcon2) ;6 - Focus Switch _GUICtrlButton_SetImageList($btn1, $hImagebtn1) ;single state image Bitmap $btn2 = GUICtrlCreateButton("Disable", 30, 70, 90, 32) GUICtrlSetTip(-1, "Single bitmap imagelist") $hImagebtn2 = _GUIImageList_Create(24, 24, 5, 3) _GUIImageList_AddBitmap($hImagebtn2, $sRed);1 - Normal _GUICtrlButton_SetImageList($btn2, $hImagebtn2) ;single state image Icon $btn3 = GUICtrlCreateButton("Unlock", 30, 110, 90, 40) GUICtrlSetTip(-1, "Single icon imagelist") $hImagebtn3 = _GUIImageList_Create(32, 32, 5, 3) _GUIImageList_AddIcon($hImagebtn3, "shell32.dll", 47, True) _GUICtrlButton_SetImageList($btn3, $hImagebtn3) ;single state image Bitmap with overlay text $btn4 = GUICtrlCreateButton("Help", 30, 160, 90, 32) GUICtrlSetTip(-1, "Single bitmap imagelist with overlayed text") GUICtrlSetFont(-1, 14, 800, -1, "Comic Sans MS") $hImagebtn4 = _GUIImageList_Create(90, 32, 5, 3) _GUIImageList_AddBitmap($hImagebtn4, $sRed) _GUICtrlButton_SetImageList($btn4, $hImagebtn4, 4) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $btn1 GUICtrlSetState($btn4, $GUI_FOCUS) Case $btn2 GUICtrlSetState($btn1, $GUI_DISABLE) Case $btn3 GUICtrlSetState($btn1, $GUI_ENABLE) Case $btn4 MsgBox(0, "", "Hi!") EndSwitch WEnd EndFunc ;==>_MainM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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