WildByDesign Posted July 17 Posted July 17 Problem: When creating a win32-darkmode menu bar, it is ownerdrawn and one of the known problems is that it creates a white line at the bottom. My understanding is that the white line and the menubar are both part of the non-client area. Known solutions to this problem in C++ (https://github.com/notepad-plus-plus/notepad-plus-plus/blob/bab3573be708bb908b8080e3e2007ea78a7f1932/PowerEditor/src/NppDarkMode.cpp#L672) get the size, create a dark brush and fill that line with a dark brush. But that is an area in AutoIt that I am not familiar with at all. Example: expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WinAPITheme.au3> #include "GUIDarkMode_v0.02mod.au3" #include "ModernMenuRaw.au3" DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -4) _SetMenuBkColor(0x202020) _SetMenuIconBkColor(0x202020) _SetMenuIconBkGrdColor(0x202020) _SetMenuSelectBkColor(0x202020) _SetMenuSelectRectColor(0x202020) _SetMenuSelectTextColor(0xFFFFFF) _SetMenuTextColor(0xFFFFFF) Example() Func Example() $hGUI = GUICreate("My GUI", 300, 200) ;Local $idFileMenu = GUICtrlCreateMenu("&File") Local $idFileMenu = _GUICtrlCreateODTopMenu("&File", $hGUI) GUICtrlCreateMenuItem("&Open", $idFileMenu) GUICtrlCreateMenuItem("&Save", $idFileMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idOptionsMenu = GUICtrlCreateMenu("O&ptions", $idFileMenu) GUICtrlCreateMenuItem("View", $idOptionsMenu) GUICtrlCreateMenuItem("", $idOptionsMenu) GUICtrlCreateMenuItem("Tools", $idOptionsMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idExitItem = GUICtrlCreateMenuItem("&Exit", $idFileMenu) ;Local $idHelpMenu = GUICtrlCreateMenu("&?") Local $idHelpMenu = _GUICtrlCreateODTopMenu("&?", $hGUI) Local $idAboutItem = GUICtrlCreateMenuItem("&About", $idHelpMenu) Local $idEndBtn = GUICtrlCreateButton("End", 110, 140, 70, 20) GuiDarkmodeApply($hGUI) GUISetState(@SW_SHOW) Local $idMsg ; Loop until the user exits. While 1 $idMsg = GUIGetMsg() Switch $idMsg Case $idExitItem, $idEndBtn, $GUI_EVENT_CLOSE ExitLoop Case $idAboutItem MsgBox($MB_SYSTEMMODAL, "About...", "Colored menu sample") EndSwitch WEnd EndFunc ;==>Example There are 2 UDFs that are required (at least in this example) to do the ownerdraw for the menubar and apply dark mode in the other parts of the menu items and GUI. Those are attached to this post. The link (above) to the Notepad++ source code section that handles the filling of that white line will hopefully give someone an idea of how they solve that problem. I am hoping that someone can help with a solution in AutoIt to solve the filling of that white line. I just don't have the experience with non-client area or custom brushes, etc. Thank you very much for your time. Always appreciated. GUIDarkMode_v0.02mod.au3 ModernMenuRaw.au3
argumentum Posted July 17 Posted July 17 For the next version ( now in public beta ) you'll need to change this: ; #CONSTANTS# =================================================================================================================== If Not IsDeclared("DWMWA_USE_IMMERSIVE_DARK_MODE") Then Global Const $DWMWA_USE_IMMERSIVE_DARK_MODE = (@OSBuild <= 18985) ? 19 : 20 ; before this build set to 19, otherwise set to 20, no thanks Windaube to document anything ?? ; =============================================================================================================================== WildByDesign 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
WildByDesign Posted July 17 Author Posted July 17 1 hour ago, argumentum said: For the next version ( now in public beta ) you'll need to change this: Thank you for the heads up. That reminds me that I should probably start testing the beta version as well. I did briefly check over the release notes a few days ago and there is a lot of nice changes in there. argumentum 1
ahmet Posted July 17 Posted July 17 Here is initial version. Coordinates are wrong. I need to do other things now. expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WinAPITheme.au3> #include "GUIDarkMode_v0.02mod.au3" #include "ModernMenuRaw.au3" #include <GuiMenu.au3> #include <Array.au3> #include <WinAPIDiag.au3> #include <WinAPIConv.au3> #include <WinAPIGdiDC.au3> DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext", "HWND", "DPI_AWARENESS_CONTEXT" - 4) _SetMenuBkColor(0x202020) _SetMenuIconBkColor(0x202020) _SetMenuIconBkGrdColor(0x202020) _SetMenuSelectBkColor(0x202020) _SetMenuSelectRectColor(0x202020) _SetMenuSelectTextColor(0xFFFFFF) _SetMenuTextColor(0xFFFFFF) Example() Func Example() $hGUI = GUICreate("My GUI", 300, 200) ;Local $idFileMenu = GUICtrlCreateMenu("&File") Local $idFileMenu = _GUICtrlCreateODTopMenu("&File", $hGUI) GUICtrlCreateMenuItem("&Open", $idFileMenu) GUICtrlCreateMenuItem("&Save", $idFileMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idOptionsMenu = GUICtrlCreateMenu("O&ptions", $idFileMenu) GUICtrlCreateMenuItem("View", $idOptionsMenu) GUICtrlCreateMenuItem("", $idOptionsMenu) GUICtrlCreateMenuItem("Tools", $idOptionsMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idExitItem = GUICtrlCreateMenuItem("&Exit", $idFileMenu) ;Local $idHelpMenu = GUICtrlCreateMenu("&?") Local $idHelpMenu = _GUICtrlCreateODTopMenu("&?", $hGUI) Local $idAboutItem = GUICtrlCreateMenuItem("&About", $idHelpMenu) Local $idEndBtn = GUICtrlCreateButton("End", 110, 140, 70, 20) GuiDarkmodeApply($hGUI) GUISetState(@SW_SHOW) $aMenuBarInfo = _GUICtrlMenu_GetMenuBarInfo($hGUI, 0, 1) _ArrayDisplay($aMenuBarInfo) $rcClient = _WinAPI_GetClientRect($hGUI) _WinAPI_DisplayStruct($rcClient, $tagRECT,"rcClinet before") ;CHAT GPT Local $aCall = DllCall("user32.dll", "int", "MapWindowPoints", _ "hwnd", $hGUI, _ ; hWndFrom "hwnd", 0, _ ; hWndTo "ptr", DllStructGetPtr($rcClient), _ "uint", 2) ;number of points - 2 for RECT structure If @error Then MsgBox($MB_ICONERROR, "Error", @error) Exit EndIf _WinAPI_DisplayStruct($rcClient, $tagRECT,"rcClinet after") $rcWindow = _WinAPI_GetWindowRect($hGUI) _WinAPI_OffsetRect($rcClient, -$rcWindow.left, -$rcWindow.top) $rcAnnoyingLine = DllStructCreate($tagRECT) $rcAnnoyingLine.left = $rcClient.left $rcAnnoyingLine.top = $rcClient.top $rcAnnoyingLine.right = $rcClient.right $rcAnnoyingLine.bottom = $rcClient.bottom ;~ _WinAPI_DisplayStruct($rcAnnoyingLine, $tagRECT) $rcAnnoyingLine.bottom = $rcAnnoyingLine.top $rcAnnoyingLine.top = $rcAnnoyingLine.top - 1 ;~ _WinAPI_DisplayStruct($rcAnnoyingLine, $tagRECT,"annoying line") $hDC = _WinAPI_GetDC($hGUI) $hSolidBrush=_WinAPI_CreateBrushIndirect($BS_SOLID, 0xFF00FF) _WinAPI_FillRect($hDC, $rcAnnoyingLine, $hSolidBrush) _WinAPI_ReleaseDC($hGUI, $hDC) _WinAPI_DisplayStruct($rcAnnoyingLine, $tagRECT,"annoying line") Local $idMsg ; Loop until the user exits. While 1 $idMsg = GUIGetMsg() Switch $idMsg Case $idExitItem, $idEndBtn, $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hSolidBrush) ExitLoop Case $idAboutItem MsgBox($MB_SYSTEMMODAL, "About...", "Colored menu sample") EndSwitch WEnd EndFunc ;==>Example WildByDesign and argumentum 2
WildByDesign Posted July 17 Author Posted July 17 4 hours ago, ahmet said: Here is initial version. Coordinates are wrong. I need to do other things now. Thank you for your time on this so far, it's very interesting. I am always quite amazed at what people are able to do with AutoIt. I am playing around with your code example. But I must admit, a lot of it is stuff that I have not learned yet. Something that I just thought of also is whether or not a solution can be made that will adapt with a resizable window. What I mean is that if you resize the window, the line would stay along the bottom of the menubar.
ahmet Posted July 18 Posted July 18 That line needs to be redrawn even on restore from minimize state. Once you find out when an update is neccessary you draw the line again. WildByDesign 1
WildByDesign Posted July 19 Author Posted July 19 On 7/17/2025 at 2:29 PM, ahmet said: Coordinates are wrong. I still haven’t figured out how to get the coordinates correct yet but also not sure how to manually paint the line over the non-client area.
ioa747 Posted July 19 Posted July 19 expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WinAPITheme.au3> #include "GUIDarkMode_v0.02mod.au3" #include "ModernMenuRaw.au3" DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext", "HWND", "DPI_AWARENESS_CONTEXT" - 4) _SetMenuBkColor(0x202020) _SetMenuIconBkColor(0x202020) _SetMenuIconBkGrdColor(0x202020) _SetMenuSelectBkColor(0x202020) _SetMenuSelectRectColor(0x202020) _SetMenuSelectTextColor(0xFFFFFF) _SetMenuTextColor(0xFFFFFF) Example() Func Example() $hGUI = GUICreate("My GUI", 300, 200) ;Local $idFileMenu = GUICtrlCreateMenu("&File") Local $idFileMenu = _GUICtrlCreateODTopMenu("&File", $hGUI) GUICtrlCreateMenuItem("&Open", $idFileMenu) GUICtrlCreateMenuItem("&Save", $idFileMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idOptionsMenu = GUICtrlCreateMenu("O&ptions", $idFileMenu) GUICtrlCreateMenuItem("View", $idOptionsMenu) GUICtrlCreateMenuItem("", $idOptionsMenu) GUICtrlCreateMenuItem("Tools", $idOptionsMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idExitItem = GUICtrlCreateMenuItem("&Exit", $idFileMenu) ;Local $idHelpMenu = GUICtrlCreateMenu("&?") Local $idHelpMenu = _GUICtrlCreateODTopMenu("&?", $hGUI) Local $idAboutItem = GUICtrlCreateMenuItem("&About", $idHelpMenu) Local $idEndBtn = GUICtrlCreateButton("End", 110, 140, 70, 20) GuiDarkmodeApply($hGUI) GUISetState(@SW_SHOW) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~ $hGuiRect = GUICreate("", 300, 2, 0, -1, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor (0x202020) GUISetState(@SW_SHOW, $hGuiRect) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~ Local $idMsg ; Loop until the user exits. While 1 $idMsg = GUIGetMsg() Switch $idMsg Case $idExitItem, $idEndBtn, $GUI_EVENT_CLOSE ExitLoop Case $idAboutItem MsgBox($MB_SYSTEMMODAL, "About...", "Colored menu sample") EndSwitch WEnd EndFunc ;==>Example argumentum and WildByDesign 1 1 I know that I know nothing
argumentum Posted July 19 Posted July 19 (edited) ... ;~ GUISetState(@SW_SHOW) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~ $hGuiRect = GUICreate("", 300, 2, 0, -1, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) GUISetBkColor (0x202020) GUISetState(@SW_SHOW, $hGuiRect) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~ GUISetState(@SW_SHOW, $hGUI) ... ..to avoid the flashing on load Edit: It certainly needs more code: Spoiler expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <WinAPITheme.au3> #include "GUIDarkMode_v0.02mod.au3" #include "ModernMenuRaw.au3" DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext", "HWND", "DPI_AWARENESS_CONTEXT" - 4) _SetMenuBkColor(0x202020) _SetMenuIconBkColor(0x202020) _SetMenuIconBkGrdColor(0x202020) _SetMenuSelectBkColor(0x202020) _SetMenuSelectRectColor(0x202020) _SetMenuSelectTextColor(0xFFFFFF) _SetMenuTextColor(0xFFFFFF) Example() Func Example() $hGUI = GUICreate("My GUI", 300, 200, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP)) ;~ $hGUI = GUICreate("My GUI", 300, 200) ;Local $idFileMenu = GUICtrlCreateMenu("&File") Local $idFileMenu = _GUICtrlCreateODTopMenu("&File", $hGUI) GUICtrlCreateMenuItem("&Open", $idFileMenu) GUICtrlCreateMenuItem("&Save", $idFileMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idOptionsMenu = GUICtrlCreateMenu("O&ptions", $idFileMenu) GUICtrlCreateMenuItem("View", $idOptionsMenu) GUICtrlCreateMenuItem("", $idOptionsMenu) GUICtrlCreateMenuItem("Tools", $idOptionsMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idExitItem = GUICtrlCreateMenuItem("&Exit", $idFileMenu) ;Local $idHelpMenu = GUICtrlCreateMenu("&?") Local $idHelpMenu = _GUICtrlCreateODTopMenu("&?", $hGUI) Local $idAboutItem = GUICtrlCreateMenuItem("&About", $idHelpMenu) Local $idEndBtn = GUICtrlCreateButton("End", 110, 140, 70, 20) GuiDarkmodeApply($hGUI) ;~ GUISetState(@SW_SHOW) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;~ $hGuiRect = GUICreate("", 300, 2, 0, -1, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) ; for no resize $hGuiRect = GUICreate("", 301, 2, -5, -6, $WS_POPUP, $WS_EX_MDICHILD, $hGUI) ; for resize ;~ GUISetBkColor (0x202020) ; default GUISetBkColor (0xFF00FF) ; glow in the dark =D GUISetState(@SW_SHOW, $hGuiRect) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~ GUISetState(@SW_SHOWMAXIMIZED, $hGUI) Local $idMsg ; Loop until the user exits. While 1 $idMsg = GUIGetMsg() Switch $idMsg Case $idExitItem, $idEndBtn, $GUI_EVENT_CLOSE ExitLoop Case $idAboutItem MsgBox($MB_SYSTEMMODAL, "About...", "Colored menu sample") EndSwitch WEnd EndFunc ;==>Example but, it could work. =/ Edited July 19 by argumentum more ioa747 and WildByDesign 2 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
WildByDesign Posted July 19 Author Posted July 19 3 hours ago, ioa747 said: Thank you for the example. I've never experimented with child GUI before, so this is really quite neat. It's a very creative technique to cover up the line. I'm going to continue trying some ideas based on your example. One downside that I notice is that when you move the GUI around on the screen, it will occasionally show a flicker of the white line. I don't think that GuiCreate has any kind of double-buffer option to prevent flicker but I will try a few things to see. 1 hour ago, argumentum said: Edit: It certainly needs more code: Thank you for your time as well. Yes, it looks like resize will definitely need some more code. There might be some differences depending on user systems' titlebar size (varying from resize and non-resize) and possibly some differences varying with DPI. I will see what I can do to measure those things. ioa747 and argumentum 2
WildByDesign Posted August 2 Author Posted August 2 On 7/17/2025 at 2:29 PM, ahmet said: Here is initial version. Coordinates are wrong. I need to do other things now. So I decided to come back to this _WinAPI_FillRect method to see if I could figure out the coordinates and also learn more about RECT because I had no experience with that. But I really need to solve this problem so that I can finish this project. I don't need resize, so static size/placement is fine. I ended up manually inputting the coordinates that I needed for $rcAnnoyingLine.left, $rcAnnoyingLine.top, etc. just to see if it would work for what I needed. This was neat because I could play around with different coordinates and place the line in different areas. However, I realized very quickly that I could put it anywhere in the client area but it was not going over any of the non-client area which is where that white line is. Even with $rcAnnoyingLine.top = -1 or any other negative values, it was not touching the non-client area.
Solution ahmet Posted August 2 Solution Posted August 2 Here is new script. It is neccessary to catch WM_NCPAINT and do drawing there. Coordinates are issue again. expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WinAPITheme.au3> #include "GUIDarkMode_v0.02mod.au3" #include "ModernMenuRaw.au3" #include <GuiMenu.au3> #include <Array.au3> #include <WinAPIDiag.au3> #include <WinAPIConv.au3> #include <WinAPIGdiDC.au3> ;~ DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext", "HWND", "DPI_AWARENESS_CONTEXT" - 4) _SetMenuBkColor(0x202020) _SetMenuIconBkColor(0x202020) _SetMenuIconBkGrdColor(0x202020) _SetMenuSelectBkColor(0x202020) _SetMenuSelectRectColor(0x202020) _SetMenuSelectTextColor(0xFFFFFF) _SetMenuTextColor(0xFFFFFF) Example() Func Example() $hGUI = GUICreate("My GUI", 300, 200) ;Local $idFileMenu = GUICtrlCreateMenu("&File") Local $idFileMenu = _GUICtrlCreateODTopMenu("&File", $hGUI) GUICtrlCreateMenuItem("&Open", $idFileMenu) GUICtrlCreateMenuItem("&Save", $idFileMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idOptionsMenu = GUICtrlCreateMenu("O&ptions", $idFileMenu) GUICtrlCreateMenuItem("View", $idOptionsMenu) GUICtrlCreateMenuItem("", $idOptionsMenu) GUICtrlCreateMenuItem("Tools", $idOptionsMenu) GUICtrlCreateMenuItem("", $idFileMenu) Local $idExitItem = GUICtrlCreateMenuItem("&Exit", $idFileMenu) ;Local $idHelpMenu = GUICtrlCreateMenu("&?") Local $idHelpMenu = _GUICtrlCreateODTopMenu("&?", $hGUI) Local $idAboutItem = GUICtrlCreateMenuItem("&About", $idHelpMenu) Local $idEndBtn = GUICtrlCreateButton("End", 110, 140, 70, 20) Global $hSolidBrush = _WinAPI_CreateBrushIndirect($BS_SOLID, 0xFF00FF) GUIRegisterMsg($WM_NCPAINT, WM_NCPAINT) ;~ GUIRegisterMsg($WM_ERASEBKGND,WM_ERASEBKGND) ;~ GUIRegisterMsg($WM_PAINT,WM_PAINT) ;~ GUIRegisterMsg($WM_DRAWITEM, WM_DRAWITEM2) GuiDarkmodeApply($hGUI) GUISetState(@SW_SHOW) ;_drawUAHMenuNCBottomLine($hGUI) Local $idMsg ; Loop until the user exits. While 1 $idMsg = GUIGetMsg() Switch $idMsg Case $idExitItem, $idEndBtn, $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hSolidBrush) ExitLoop Case $idAboutItem MsgBox($MB_SYSTEMMODAL, "About...", "Colored menu sample") EndSwitch WEnd EndFunc ;==>Example Func WM_DRAWITEM2($hWnd, $iMsg, $wParam, $lParam) ConsoleWrite("WM_DRAWITEM" & @CRLF) ConsoleWrite("$hwnd=" & $hWnd & @CRLF) ;~ ConsoleWrite("$hDC=" & $wParam & @CRLF) WM_DRAWITEM($hWnd, $iMsg, $wParam, $lParam) ;~ _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam) ;~ _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) ;~ _drawUAHMenuNCBottomLine($hWnd) Return True EndFunc ;==>WM_NCPAINT Func WM_PAINT($hWnd, $iMsg, $wParam, $lParam) ConsoleWrite("WM_PAINT" & @CRLF) ConsoleWrite("$hwnd=" & $hWnd & @CRLF) ;~ ConsoleWrite("$hDC=" & $wParam & @CRLF) _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) _drawUAHMenuNCBottomLine($hWnd) Return 0 EndFunc ;==>WM_NCPAINT Func WM_ERASEBKGND($hWnd, $iMsg, $wParam, $lParam) ConsoleWrite("WM_ERASEBKGND" & @CRLF) ConsoleWrite("$hwnd=" & $hWnd & @CRLF) ConsoleWrite("$hDC=" & $wParam & @CRLF) ;_WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) _drawUAHMenuNCBottomLine($hWnd) Return 1 EndFunc ;==>WM_NCPAINT Func WM_NCPAINT($hWnd, $iMsg, $wParam, $lParam) ConsoleWrite("$hwnd=" & $hWnd & @CRLF) ConsoleWrite("$wParam=" & $wParam & @CRLF) _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam) _drawUAHMenuNCBottomLine($hWnd) Return 0 EndFunc ;==>WM_NCPAINT Func _drawUAHMenuNCBottomLine($hWnd) $aMenuBarInfo = _GUICtrlMenu_GetMenuBarInfo($hWnd, 0, 1) ;_ArrayDisplay($aMenuBarInfo) $rcClient = _WinAPI_GetClientRect($hWnd) ;_WinAPI_DisplayStruct($rcClient, $tagRECT, "rcClinet before") ;CHAT GPT Local $aCall = DllCall("user32.dll", "int", "MapWindowPoints", _ "hwnd", $hWnd, _ ; hWndFrom "hwnd", 0, _ ; hWndTo "ptr", DllStructGetPtr($rcClient), _ "uint", 2) ;number of points - 2 for RECT structure If @error Then ;MsgBox($MB_ICONERROR, "Error", @error) Exit EndIf ;_WinAPI_DisplayStruct($rcClient, $tagRECT, "rcClinet after") $rcWindow = _WinAPI_GetWindowRect($hWnd) _WinAPI_OffsetRect($rcClient, -$rcWindow.left, -$rcWindow.top) $rcAnnoyingLine = DllStructCreate($tagRECT) $rcAnnoyingLine.left = $rcClient.left $rcAnnoyingLine.top = $rcClient.top $rcAnnoyingLine.right = $rcClient.right $rcAnnoyingLine.bottom = $rcClient.bottom ;~ _WinAPI_DisplayStruct($rcAnnoyingLine, $tagRECT) $rcAnnoyingLine.bottom = $rcAnnoyingLine.top $rcAnnoyingLine.top = $rcAnnoyingLine.top - 1 ;~ _WinAPI_DisplayStruct($rcAnnoyingLine, $tagRECT,"annoying line") ;~ $rcAnnoyingLine.left = 0 ;~ $rcAnnoyingLine.top = 0 ;~ $rcAnnoyingLine.right = 100 ;~ $rcAnnoyingLine.bottom = 200 $hRgn=_WinAPI_CreateRectRgn(0,0,1000,500) ;~ $hDC = _WinAPI_GetDC($hWnd) $hDC=_WinAPI_GetDCEx($hWnd,$hRgn, BitOR($DCX_WINDOW,$DCX_INTERSECTRGN)) If $hDC=0 Then ConsoleWrite("hDC=0" & @CRLF) EndIf _WinAPI_FillRect($hDC, $rcAnnoyingLine, $hSolidBrush) _WinAPI_ReleaseDC($hWnd, $hDC) ;_WinAPI_DisplayStruct($rcAnnoyingLine, $tagRECT, "annoying line") EndFunc ;==>_drawUAHMenuNCBottomLine WildByDesign and ioa747 1 1
WildByDesign Posted August 3 Author Posted August 3 18 hours ago, ahmet said: Here is new script. It is neccessary to catch WM_NCPAINT and do drawing there. Coordinates are issue again I am trying a few different ways to do coordinates in a different way with success. Although it is tricky because each DPI scaling setting makes coordinates different. But I can definitely work with this. I also added a function to paint the line anytime the app loses focus. The best part about your solution is that it works when applying backdrop materials line Mica and Acrylic. The painted line also accepts the backdrop which is perfect. The solution with the child GUI could not do that. I am going to mark your post as solution because it works well enough for my needs. If you ever feel the need to improve it, please feel free to update the code in the post marked as solution. Thank you so much.
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