Jump to content

Recommended Posts

Posted (edited)

@Nine I am curious about potentially adding a slightly rounded corner to the buttons. I'm not even sure if I want rounded corners or not, but I am wondering about trying it to see how it might look.

From your WM_NOTIFY:

Case $WM_NOTIFY
    Local $tInfo = DllStructCreate($tagNMCUSTOMDRAWINFO, $lParam)
    If _WinAPI_GetClassName($tInfo.hWndFrom) = "Button" And $tInfo.Code = $NM_CUSTOMDRAW Then
        Local $tRECT = DllStructCreate($tagRECT, DllStructGetPtr($tInfo, "left"))
        _WinAPI_RoundRect($tInfo.hdc, $tRECT, 4, 4)

I added the _WinAPI_RoundRect line but I don't really understand it. So clearly I am doing it wrong because it didn't work.

Could it be used to round the corners of the buttons?

Edited by WildByDesign
Posted
8 hours ago, Nine said:

It does not work for me.

What is your @OSBuild?

Just to confirm, the MsgBoxEx-Example.au3 script is crashing, is that correct?

I'm going to figure that out today.

Posted
2 hours ago, WildByDesign said:

What is your @OSBuild?

26200

2 hours ago, WildByDesign said:

MsgBoxEx-Example.au3 script is crashing

Not crashing, just not doing any visual effect.  I'm starting to think there is a setup somewhere that I need to enable, but I have no idea what it could be...

Posted
5 minutes ago, Nine said:

Not crashing, just not doing any visual effect.  I'm starting to think there is a setup somewhere that I need to enable, but I have no idea what it could be...

Your build is the latest and greatest, so that is good. I recall from the other day that the single GUI example with material effects did work for you, so that is also good. That means that Transparency effects is enabled in the Settings app.

By the way, by default, I have the following line in MsgBoxEx-Example.au3 commented out:

_MsgBoxExMica($DWMSBT_TRANSIENTWINDOW)

I kept it commented out so that users could test the original dark mode by default and enable the material effects by uncommenting that line. Is it possible that the line is still commented out?

By the way, I've got some really nice improvements for later today. I've got it to draw the underline where the ampersand is on Yes, No, etc. This will be beneficial for users who like to navigate MsgBox via keyboard. Some improved DPI changes as well and improved button text.

Posted
9 minutes ago, Nine said:

Yes it was, but uncommenting it does not change the visual effect :

I think by default I had plain Mica which is hard to see generally.

Try changing:

_MsgBoxExMica($DWMSBT_MAINWINDOW)

To:

_MsgBoxExMica($DWMSBT_TRANSIENTWINDOW)

In the Example file. It should give a better indication. If the original one failed to do the material, the background would be flat black (0x000000). But it is showing the grey in your screenshot, so something is happening. Just not sure what.

Also, with any of the Win11 material effects, any window that has the effects will turn grey when it is not the foreground window. The reason for that is by design, showing the material effect only on the window which has foreground focus makes it easier to know which app on the desktop is actually the active app.

Posted

I'm glad it's working. One of my favourites is Mica Alt (aka Tabbed).

_MsgBoxExCustom($DWMSBT_TABBEDWINDOW)

Try that one also. Then drag the window all over the desktop over different areas of the wallpaper and it will really show off the visual effects the most out of all material effects.

I actually use that for coding all of my AutoIt stuff. I have the entire windows for SciTE and VSCodium fully Mica Alt effect. I find it much easier on the eyes and have a hard time switching back to regular dark mode.

Acrylic, on the other hand, can be very difficult on the eyes. Fancy yet distracting.

Posted
Posted
16 minutes ago, Nine said:

I believe it won't work with CustomDraw, you would need to use OwnerDraw.  But since you do not have the control over the buttons, I don't think it is possible.

Thanks for confirming. I was mostly just curious, so that is not a problem. I actually quite like the rectangle buttons as they are now because it fits in good with the overall Windows 11 theme.

Posted (edited)

I just updated the scripts in the first post.

  • Added custom text color
  • Brought back underline on buttons under first letter with ampersand (eg. Yes, No, etc.) to better navigate by keyboard
  • Added _MsgBoxExCustom() to customize all colors and Win11 materials
  • Added example for _MsgBoxExCustom() in Example script, but needs to be uncommented

You can make the MsgBox (top/bottom/buttons/text) any color of the rainbow now. Please keep in mind that for Windows 11 material effects, anywhere from 0x000000 to 0x202020 is best for allowing the material effects to show through.

Attention: I need some help testing the DPI adjustments to the button text placement. I have tested 100% to 175% scaling but I need anyone who has monitors with 200% or higher scaling to test. Particularly, the vertical centering is the main thing to pay attention to. But if there is any issue with horizontal centering, please let me know as well.

Here is the function for setting custom colors and Win11 materials. The logic was not as good as I was hoping because sometimes you want to pass 0x000000 to set a flat black, but the function would also count that as "", or nothing essentially. So I may have to make some adjustments here. But it does work very well, so maybe it is OK. This is my first time creating a function with Default as parameters.

; #FUNCTION# ====================================================================================================================
; Name ..........: _MsgBoxExCustom
; Description ...: Sets custom colors and materials
; Syntax ........: _MsgBoxExCustom($iBgColorTop, $iBgColorBottom, $iBgColorButton, $iTextColor, $iMaterial)
; Parameters ....: $iBgColorTop       - [optional] 0xRRGGBB (RGB value). Default is $MSGBOX_BG_TOP.
;                  $iBgColorBottom    - [optional] 0xRRGGBB (RGB value). Default is $MSGBOX_BG_BOTTOM.
;                  $iBgColorButton    - [optional] 0xRRGGBB (RGB value). Default is $MSGBOX_BG_BUTTON.
;                  $iTextColor        - [optional] 0xRRGGBB (RGB value). Default is $MSGBOX_TEXT.
;                  $iMaterial         - [optional] Integer. Default is blank. Options below:
;                                     - $DWMSBT_AUTO               ; Default (Auto)
;                                     - $DWMSBT_NONE               ; None
;                                     - $DWMSBT_MAINWINDOW         ; Mica
;                                     - $DWMSBT_TRANSIENTWINDOW    ; Acrylic
;                                     - $DWMSBT_TABBEDWINDOW       ; Mica Alt (Tabbed)
; Return values .: None
; Author ........: WildByDesign
; Remarks .......: Windows 11 material effects look best with background values between 0x000000 and 0x202020
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _MsgBoxExCustom($iBgColorTop = Default, $iBgColorBottom = Default, $iBgColorButton = Default, $iTextColor = Default, $iMaterial = Default)
    If $iBgColorTop <> Default Then $MSGBOX_BG_TOP = _WinAPI_SwitchColor($iBgColorTop)
    If $iBgColorBottom <> Default Then $MSGBOX_BG_BOTTOM = _WinAPI_SwitchColor($iBgColorBottom)
    If $iBgColorButton <> Default Then $MSGBOX_BG_BUTTON = _WinAPI_SwitchColor($iBgColorButton)
    If $iTextColor <> Default Then $MSGBOX_TEXT = _WinAPI_SwitchColor($iTextColor)
    If $iMaterial <> Default And $iMaterial <> "" And @OSBuild >= 22621 Then
        $g_bUseMica = True
        $g_iMaterial = $iMaterial
    EndIf
EndFunc   ;==>_MsgBoxExCustom

 

Edited by WildByDesign

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...