WildByDesign Posted 19 hours ago Author Posted 19 hours ago GUIDarkTheme 2.1.4 Improved separator visibility between tabs in tab control Fixed ListView control border and sizebox measurements Fixed ListBox control border measurements Lowered brightness of UpDown control button borders argumentum and ioa747 2
bladem2003 Posted 12 hours ago Posted 12 hours ago (edited) When a tab is created, the transparent label turns white. #include <StaticConstants.au3> #include "GUIDarkTheme.au3" $hGui = GUICreate("", 300, 200) GUICtrlCreateTab(10, 25, 200, 30) GUICtrlCreateTabItem("tab0") GUICtrlCreateTabItem("tab1") GUICtrlCreateTabItem("tab2") GUICtrlCreateTabItem("") ; end tabitem definition GUICtrlCreateLabel("1111", 10, 100, 100, 20, BitOR($SS_LEFT, $SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xffffff) _GUIDarkTheme_ApplyDark($hGui) GUISetState() While 1 Sleep(10) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd Edited 12 hours ago by bladem2003
WildByDesign Posted 12 hours ago Author Posted 12 hours ago 10 minutes ago, bladem2003 said: When a tab is created, the transparent label turns white. Thanks for reporting this issue. I will look into this now. I will add detection for $GUI_BKCOLOR_TRANSPARENT and find way to handle it. bladem2003 1
WildByDesign Posted 9 hours ago Author Posted 9 hours ago (edited) @bladem2003 I remembered that I designed the Static controls (labels) to use a NULL_BRUSH by default if no color is specified. Therefore transparent. Try with simply removing the GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) line. #include <StaticConstants.au3> #include "GUIDarkTheme.au3" $hGui = GUICreate("", 300, 200) GUICtrlCreateTab(10, 25, 200, 30) GUICtrlCreateTabItem("tab0") GUICtrlCreateTabItem("tab1") GUICtrlCreateTabItem("tab2") GUICtrlCreateTabItem("") ; end tabitem definition GUICtrlCreateLabel("1111", 10, 100, 100, 20, BitOR($SS_LEFT, $SS_CENTERIMAGE)) ; GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ; try with this line removed GUICtrlSetColor(-1, 0xffffff) _GUIDarkTheme_ApplyDark($hGui) GUISetState() While 1 Sleep(10) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd For Static/label controls, I designed it like this: If no background color is specified, make label background transparent with null brush If user has a background color set, honour the color and set label brush to user set color If label is within a tab control, use tab control background as label brush Please test with code above and see if that is OK. That is the logic that I am using so far for Static/label controls. But it can always be improved if there are problems. Edited 9 hours ago by WildByDesign
bladem2003 Posted 9 hours ago Posted 9 hours ago (edited) Yes, that works, but if I change the background color and then set it back to transparent, the white color reappears. The last version I used was 2.00, and there were no problems with transparency there. Or is there another way to display the label transparently, when I change the background color and then want it to be transparent again? #include <StaticConstants.au3> #include "GUIDarkTheme.au3" $hGui = GUICreate("", 300, 200) GUICtrlCreateTab(10, 25, 200, 30) GUICtrlCreateTabItem("tab0") GUICtrlCreateTabItem("tab1") GUICtrlCreateTabItem("tab2") GUICtrlCreateTabItem("") ; end tabitem definition $idLabel = GUICtrlCreateLabel("1111", 10, 100, 100, 20, BitOR($SS_LEFT, $SS_CENTERIMAGE)) ;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xffffff) _GUIDarkTheme_ApplyDark($hGui) GUISetState() GUICtrlSetBkColor($idLabel, 0xff0000) GUICtrlSetBkColor($idLabel, $GUI_BKCOLOR_TRANSPARENT) While 1 Sleep(10) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd Edited 9 hours ago by bladem2003
WildByDesign Posted 8 hours ago Author Posted 8 hours ago 58 minutes ago, bladem2003 said: Yes, that works, but if I change the background color and then set it back to transparent, the white color reappears. I see exactly what you mean now. 58 minutes ago, bladem2003 said: Or is there another way to display the label transparently, when I change the background color and then want it to be transparent again? I am not quite ready to do a full release. But please try the following (replace __GUIDarkTheme_WM_CTLCOLOR function) : expandcollapse popupFunc __GUIDarkTheme_WM_CTLCOLOR($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hDC = $wParam Local $hCtrl = $lParam Local $hBrush, $hNull Local $sClass = __DM_WinAPI_GetClassName($hCtrl) If $sClass <> "Static" And $sClass <> "Button" Then Return $GUI_RUNDEFMSG Local $iTextColor, $iBkColor, $iBkMode __GUIDarkTheme_GetCtrlColors($hCtrl, $iTextColor, $iBkColor, $iBkMode) Local $sStyles = __GUIDarkTheme_hWnd2Styles($hCtrl) ; leave Static controls with SS_ICON alone If StringInStr($sStyles, "SS_ICON") Then Return $GUI_RUNDEFMSG ; this is needed to retain the original colors set when first swapped in _GUIDarkTheme_GUICtrlSetDarkTheme __DM_WinAPI_SetTextColor($hDC, __DM_ColorToCOLORREF($iTextColor)) __DM_WinAPI_SetBkMode($hDC, $TRANSPARENT) Local $hTabControl = __DM_WinAPI_FindWindowEx($hWnd, "SysTabControl32") If $hTabControl Then If __GUIDarkTheme_IsCtrlInTab($hTabControl, $hCtrl) Then $hBrush = $__DM_g_hBrushCtrl Return $hBrush Else If $sClass = "Button" Then Return $GUI_RUNDEFMSG Switch $iBkColor Case $__DM_g_iCtrlBkColor ; transparent background $hNull = __DM_WinAPI_GetStockObject($NULL_BRUSH) If $hNull Then Return $hNull ; Fallback if not available: Return $GUI_RUNDEFMSG Case $__DM_g_iGuiBkColor ; transparent background $hNull = __DM_WinAPI_GetStockObject($NULL_BRUSH) If $hNull Then Return $hNull ; Fallback if not available: Return $GUI_RUNDEFMSG Case 0xFFFFFF ; transparent background $hNull = __DM_WinAPI_GetStockObject($NULL_BRUSH) If $hNull Then Return $hNull ; Fallback if not available: Return $GUI_RUNDEFMSG Case Else ; return same color brush when user set custom background color (eg. 0x00FF00) $hBrush = __DM_WinAPI_CreateSolidBrush(__DM_ColorToCOLORREF($iBkColor)) Return $hBrush EndSwitch EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>__GUIDarkTheme_WM_CTLCOLOR Please let me know if that is working. bladem2003 1
xuankhanh1982 Posted 6 hours ago Posted 6 hours ago (edited) expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GUIDarkTheme.au3> Global $g_DpiRatio = _ApplyDpiScaling() a() Func a() $Form1 = GUICreate("Form1", 615*$g_DpiRatio, 437*$g_DpiRatio, -1, -1, $ws_sysmenu) $input = GUICtrlCreateInput(@SystemDir, 65, 5, 340, 20) GUICtrlSetState(-1, 128) $disable_input = GUICtrlCreateButton("Disable Input", 60, 40, 100, 35) $emable_input = GUICtrlCreateButton("Emable Input", 180, 40, 100, 35) $Combo1 = GUICtrlCreateCombo("None", 168, 168, 129, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Combo1|Combo2|Combo3", "Combo1") $Button1 = GUICtrlCreateButton("Button1", 168, 264, 89, 49) $Radio1 = GUICtrlCreateRadio("Radio1", 360, 112, 121, 41) $lb = GUICtrlCreateLabel("Label1", 50, 150, Default, 15) $Group1 = GUICtrlCreateGroup("Group1", 350, 40, 113, 49) GUICtrlCreateGroup("", -99, -99, 1, 1) $Tab1 = GUICtrlCreateTab(352, 240, 153, 80) $TabSheet1 = GUICtrlCreateTabItem("config") $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 360, 270, 100, 15) $TabSheet2 = GUICtrlCreateTabItem("TabSheet1") GUICtrlCreateTabItem("") _GUIDarkTheme_ApplyDark($Form1, True) ;~ _GUIDarkTheme_ApplyLight($Form1) GUICtrlSetBkColor($Combo1, $__DM_g_iCtrlBkColor) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $disable_input GUICtrlSetState($input, 128) Case $emable_input GUICtrlSetState($input, 64) Case $Button1 b() EndSwitch WEnd EndFunc Func b() $Form2 = GUICreate("Form2", 389*$g_DpiRatio, 188*$g_DpiRatio, 192, 124) $Button2 = GUICtrlCreateButton("Button2", 152, 120, 73, 33) $Label2 = GUICtrlCreateLabel("Label2", 104, 48, Default, 15) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 248, 48, 65, 25) $Radio2 = GUICtrlCreateRadio("Radio2", 288, 128, 57, 25) $List2 = GUICtrlCreateList("6556565", 24, 88, 97, 45) _GUIDarkTheme_ApplyDark($Form2, True) ;~ _GUIDarkTheme_ApplyLight($Form2) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Local $sMsg = "GUIDarkTheme UDF" & @CRLF $sMsg &= "Version: " & @TAB & _GUIDarkTheme_Version() _GUIDarkTheme_MsgBox(64+262144, "About", $sMsg, 0, $Form2) EndSwitch WEnd EndFunc Func _ApplyDpiScaling() Local Const $DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = - 2 __DM_WinAPI_SetProcessDpiAwarenessContext($DPI_AWARENESS_CONTEXT_SYSTEM_AWARE) Local $iDPI = Round(__DM_WinAPI_GetDpiFromDpiAwarenessContext($DPI_AWARENESS_CONTEXT_SYSTEM_AWARE)/96, 2) If @error Then $iDPI = 1 Return $iDPI EndFunc ;==>_ApplyDpiScaling @bladem2003 Can you re-upload version 2.0.0? @WildByDesign When I click the "GUICtrlCreateCombo" button, the background color doesn't match the dark theme Edited 6 hours ago by xuankhanh1982 WildByDesign and argumentum 2
WildByDesign Posted 5 hours ago Author Posted 5 hours ago 1 hour ago, xuankhanh1982 said: When I click the "GUICtrlCreateCombo" button, the background color doesn't match the dark theme Thank you for reporting this bug. I just fixed it locally. I will update a new release in the morning. argumentum 1
WildByDesign Posted 4 hours ago Author Posted 4 hours ago (edited) GUIDarkTheme 2.2.0 Removed subclassing for $WM_CTLCOLORSTATIC messages Handling Static (label) controls without subclassing now Switched many larger If statements to use Ternary instead Fixed issue when $GUI_BKCOLOR_TRANSPARENT is used as label background color Fixed regression with ComboBox drop-down not showing dark mode Fixed some tab control compatibility issues with various controls Script breaking changes in 2.2.0: Primary functions to initiate GUIDarkTheme UDF now only use one parameter (GUI handle) _GUIDarkTheme_ApplyAuto, _GUIDarkTheme_ApplyDark, _GUIDarkTheme_ApplyLight only need GUI handle as param Many other (internal) functions have been simplified as well Removed support for applying Windows 11 materials (eg. Mica) I am not a big fan of making any script breaking changes. But GUIDarkTheme UDF was getting too complex and I lost my own focus by adding a poor implementation of Windows 11 materials and so on. Many of the functions that initiate GUIDarkTheme UDF ended up having four (4) or more parameters which was confusing and silly. Now, they simply use one parameter which is the GUI handle. The UDF itself determines the best control theming to use based on the operating system build detected. GUIDarkTheme UDF is "lean and mean" once again (pun on WIN32_LEAN_AND_MEAN) and the only focus is being the best dark theme (and light) possible and making that automatic switch as smooth as possible. I apologize for making these script breaking changes. I put a lot of thought into it and I sincerely believe that it will be much better for the long term of this UDF and will be worth it. Especially for anyone who uses GUIDarkTheme UDF for the first time. Having said all of that, this release really is "lean and mean". Lots of bugs fixed and removed some unneeded subclassing which has now improved the overall performance of the existing subclassing. Edited 4 hours ago by WildByDesign bladem2003 and argumentum 2
xuankhanh1982 Posted 2 hours ago Posted 2 hours ago @WildByDesign How do I change the color of "GUICtrlCreateProgress" back to the default Windows blue in dark mode?
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