Fantastic Posted November 27, 2009 Share Posted November 27, 2009 Hello to everyone, experts help needed. Is there any way to draw an Icon over an Image, but image remaining as the background. If so could the image be as background of a checkbox? Change this "D:\commando.jpg" with an image. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Test() Func Test() Local $nMsg1,$Button3 GUICreate("My gui", 264, 300, -1, -1, $WS_SYSMENU, $WS_EX_TOPMOST) GUISetBkColor(0xFB11FF) GUICtrlCreatePic("D:\commando.jpg", 24, 60, 200, 130) GUICtrlCreateCheckbox("Test checkbox", 24, 70, 217, 17) GUICtrlCreateIcon("shell32.dll", 10, 35, 100) $Button3 = GUICtrlCreateButton("Exit", 65, 230, 107, 33) GUISetState(@SW_SHOW) While 1 $nMsg1 = GUIGetMsg() Select Case $nMsg1 = $GUI_EVENT_CLOSE Exit Case $nMsg1 = $Button3 Exit EndSelect WEnd EndFunc ;==>Test [u]My current project:[/u] [size="1"]A bootable USB[/size]Webpage:*http://mylittlesoft.blogspot.com/ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 27, 2009 Moderators Share Posted November 27, 2009 Fantastic, For transparent checkboxes look here. For transparent icons look here. M23 P.S. Trying "Search" is usually a good idea before posting. 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...
Fantastic Posted November 28, 2009 Author Share Posted November 28, 2009 Thank you Melba23.I'm working on Icons.au3 because I'm using it somewhere. I can't get it working right now because when displaying an image it (the script) uses crop.As for the checkbox it's over an image so that doesn't work.Any other ideas/solutions ? [u]My current project:[/u] [size="1"]A bootable USB[/size]Webpage:*http://mylittlesoft.blogspot.com/ Link to comment Share on other sites More sharing options...
Zedna Posted November 28, 2009 Share Posted November 28, 2009 You need to call GUICtrlSetState(-1,$GUI_DISABLE)after GUICtrlCreatePic() See the helpfile for details. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Dolemite50 Posted November 29, 2009 Share Posted November 29, 2009 Hi, If I want to use a bg image for an icon button's hover state and hide it on rollout,.. how do I detect the rollover when the button is disabled/hidden? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 29, 2009 Moderators Share Posted November 29, 2009 Fantastic, I have been working on a transparent checkbox for you. How does this look? expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #Include <WinAPI.au3> Global $fState = False, $iCurr_Check = 0, $fCurr_Trans = False Global $iBorder = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME) Global $iCaption = _WinAPI_GetSystemMetrics($SM_CYCAPTION) Global $iX = 80, $iY = 100, $iSize = 12 Global $iDraw_X = $iX + $iBorder, $iDraw_Y = $iY + $iBorder + $iCaption $hGUI = GUICreate("Tranparent Checkbox", 350, 300) GUISetBkColor(0xFB11FF) GUICtrlCreatePic("Your_Pic", 24, 60, 200, 130) GUICtrlSetState(-1, $GUI_DISABLE) ; Create a normal checkbox $hCheck = GUICtrlCreateCheckbox("Unchecked Normal Checkbox", 80, 60, 300, 17) $hButton = GUICtrlCreateButton("Exit", 65, 230, 107, 33) GUISetState(@SW_SHOW) ; Create our replacement checkbox AFTER we have created the GUI ; Create a transparent graphic control to "click" $hGraphic = GUICtrlCreateGraphic($iX, $iY, $iSize, $iSize, $SS_NOTIFY) ; Draw a "Checkbox" box $hDC = _WinAPI_GetWindowDC($hGUI) $hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0) $obj_orig = _WinAPI_SelectObject($hDC, $hPen) Draw_Box() ; Create the "Checkbox" label $hLabel = GUICtrlCreateLabel("Unchecked Transparent Checkbox", 100, 100, 300, 20) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hButton _WinAPI_SelectObject($hDC, $obj_orig) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC(0, $hDC) Exit Case $hGraphic If $fState = True Then _WinAPI_RedrawWindow($hGUI) Draw_Box() $fState = False Else _WinAPI_RedrawWindow($hGUI) Draw_Box() _WinAPI_DrawLine($hDC, $iDraw_X + 3, $iDraw_Y + 6, $iDraw_X + 6, $iDraw_Y + 9) _WinAPI_DrawLine($hDC, $iDraw_X + 6, $iDraw_Y + 9, $iDraw_X + 9, $iDraw_Y + 2) _WinAPI_DeleteObject($hPen) $fState = True EndIf EndSwitch ; How to read the normal checkbox If GUICtrlRead($hCheck) <> $iCurr_Check Then $iCurr_Check = GUICtrlRead($hCheck) Switch $iCurr_Check Case 4 GUICtrlSetData($hCheck, "Unchecked Normal Checkbox") Case 1 GUICtrlSetData($hCheck, "Checked Normal Checkbox") EndSwitch EndIf ; How to read the transparent checkbox - not really very different!!!!!!!! If $fState <> $fCurr_Trans Then $fCurr_Trans = $fState Switch $fCurr_Trans Case True GUICtrlSetData($hLabel, "Checked Transparent Checkbox") Case False GUICtrlSetData($hLabel, "Unchecked Transparent Checkbox") EndSwitch EndIf WEnd Func Draw_Box() _WinAPI_DrawLine($hDC, $iDraw_X, $iDraw_Y, $iDraw_X + $iSize, $iDraw_Y) _WinAPI_DrawLine($hDC, $iDraw_X + $iSize, $iDraw_Y, $iDraw_X + $iSize, $iDraw_Y + $iSize) _WinAPI_DrawLine($hDC, $iDraw_X + $iSize, $iDraw_Y + $iSize, $iDraw_X, $iDraw_Y + $iSize) _WinAPI_DrawLine($hDC, $iDraw_X, $iDraw_Y + $iSize, $iDraw_X, $iDraw_Y) EndFunc It works nicely for me. 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...
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