milos83 Posted January 9, 2018 Share Posted January 9, 2018 (edited) I can create a hole in a semi transparent gui but I don't know how to create a rounded rectangle hole. I need this shape: See my two examples Example one: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <winapi.au3> $hGUI = GUICreate("a",1000,800,100,100,-1,$WS_EX_LAYERED);can be $WS_POPUP GUISetBkColor(0x0000) ; will change background color ;~ WinSetTrans($hGUI,"",100) GUISetState() _WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 100) $g1 = GUICtrlCreateGraphic(0,0,0,0) GUICtrlSetGraphic(-1,$GUI_GR_COLOR,0xABCDEF,0xABCDEF) ;~ GUICtrlSetGraphic(-1, $GUI_GR_ELLIPSE, 0, 0, 100, 30, 10) GUICtrlSetGraphic(-1, $GUI_GR_RECT, 100, 100, 100, 30) GUICtrlSetGraphic(-1, $GUI_GR_REFRESH) While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit Wend Example two: expandcollapse popup#include <winapi.au3> #include <WinAPIGdi.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0x0000) WinSetTrans($hGUI,"",100) _GUICreateInvRect($hGUI, 50, 50, 80, 30) GUISetState() While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit Wend Func _GUICreateInvRect($hWnd, $iX, $iY, $iW, $iH) $aPos = WinGetPos($hWnd) Local $hMask_1 = _WinAPI_CreateRectRgn(0, 0, $aPos[2], $iY) Local $hMask_2 = _WinAPI_CreateRectRgn(0, 0, $iX, $aPos[3]) Local $hMask_3 = _WinAPI_CreateRectRgn($iX + $iW, 0, $aPos[2], $aPos[3]) Local $hMask_4 = _WinAPI_CreateRectRgn(0, $iY + $iH, $aPos[2], $aPos[3]) _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_2, 2) _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_3, 2) _WinAPI_CombineRgn($hMask_1, $hMask_1, $hMask_4, 2) _WinAPI_DeleteObject($hMask_2) _WinAPI_DeleteObject($hMask_3) _WinAPI_DeleteObject($hMask_4) _WinAPI_SetWindowRgn($hWnd, $hMask_1, 1) EndFunc Thanks in advance. Edited January 10, 2018 by milos83 Link to comment Share on other sites More sharing options...
spudw2k Posted January 10, 2018 Share Posted January 10, 2018 A quick search brought up this post: Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
milos83 Posted January 10, 2018 Author Share Posted January 10, 2018 9 hours ago, spudw2k said: A quick search brought up this post: I did far more then a quick search. The code provided creates a circle, but what I need is a rect with radius. Any clues? Thank you for your effort Link to comment Share on other sites More sharing options...
jchd Posted January 10, 2018 Share Posted January 10, 2018 Sorry to ask, but what is a rectangle with radius? kylomas 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
milos83 Posted January 10, 2018 Author Share Posted January 10, 2018 Just now, jchd said: Sorry to ask, but what is a rectangle with radius? Its a rounded rectangle Link to comment Share on other sites More sharing options...
jchd Posted January 10, 2018 Share Posted January 10, 2018 Did you search for "round corner rectangle" ? This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
milos83 Posted January 10, 2018 Author Share Posted January 10, 2018 12 minutes ago, jchd said: Did you search for "round corner rectangle" ? I did but it didn't help. All examples I found are creating round control or round gui... I don't know how to use those examples in order to make a hole. Tried using _WinAPI_CreateRoundRectRgn instead of _WinAPI_CreateRectRgn but again the invisible part is reversed (the rounded rect is visible, rest of the gui is not) Thanks in advance Link to comment Share on other sites More sharing options...
jchd Posted January 10, 2018 Share Posted January 10, 2018 Search again! This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
spudw2k Posted January 12, 2018 Share Posted January 12, 2018 I tweaked the the _GuiHole function in the _WinAPI_CreateRoundRectRgn example in the help file to produce this result. #include <winapi.au3> #include <WinAPIGdi.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0x0000) WinSetTrans($hGUI,"",100) _GuiHole($hGUI, 50, 50, 80, 30, 8, 8) GUISetState() While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit Wend Func _GuiHole($hWin, $iX, $iY, $iSizeW, $iSizeH, $iWidthEllipse, $iHeightEllipse) Local $hOuter_rgn, $hInner_rgn, $hCombined_rgn, $aPos = WinGetPos($hWin) $hOuter_rgn = _WinAPI_CreateRectRgn(0, 0, $aPos[2], $aPos[3]) $hInner_rgn = _WinAPI_CreateRoundRectRgn($iX, $iY, $iX + $iSizeW, $iY + $iSizeH, $iWidthEllipse, $iHeightEllipse) $hCombined_rgn = _WinAPI_CreateRoundRectRgn(0, 0, 0, 0, 0 ,0) _WinAPI_CombineRgn($hCombined_rgn, $hOuter_rgn, $hInner_rgn, $RGN_DIFF) _WinAPI_DeleteObject($hOuter_rgn) _WinAPI_DeleteObject($hInner_rgn) _WinAPI_SetWindowRgn($hWin, $hCombined_rgn) EndFunc ;==>_GuiHole Parsix, Skysnake and milos83 3 Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
milos83 Posted January 13, 2018 Author Share Posted January 13, 2018 On 1/12/2018 at 1:21 AM, spudw2k said: I tweaked the the _GuiHole function in the _WinAPI_CreateRoundRectRgn example in the help file to produce this result. #include <winapi.au3> #include <WinAPIGdi.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 500, 500) GUISetBkColor(0x0000) WinSetTrans($hGUI,"",100) _GuiHole($hGUI, 50, 50, 80, 30, 8, 8) GUISetState() While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit Wend Func _GuiHole($hWin, $iX, $iY, $iSizeW, $iSizeH, $iWidthEllipse, $iHeightEllipse) Local $hOuter_rgn, $hInner_rgn, $hCombined_rgn, $aPos = WinGetPos($hWin) $hOuter_rgn = _WinAPI_CreateRectRgn(0, 0, $aPos[2], $aPos[3]) $hInner_rgn = _WinAPI_CreateRoundRectRgn($iX, $iY, $iX + $iSizeW, $iY + $iSizeH, $iWidthEllipse, $iHeightEllipse) $hCombined_rgn = _WinAPI_CreateRoundRectRgn(0, 0, 0, 0, 0 ,0) _WinAPI_CombineRgn($hCombined_rgn, $hOuter_rgn, $hInner_rgn, $RGN_DIFF) _WinAPI_DeleteObject($hOuter_rgn) _WinAPI_DeleteObject($hInner_rgn) _WinAPI_SetWindowRgn($hWin, $hCombined_rgn) EndFunc ;==>_GuiHole @spudw2k Thank you! I have learned from your example! @jchd Now, searching for 'rounded rectangle hole' produces actual results! Xandy 1 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