Jump to content

Recommended Posts

Posted

In a Dark Theme UDF that I have been working on recently, one of the remaining controls left to receive any kind of dark mode treatment is SysDateTimePick32. Subclassing methods in other programming languages are scarce and it seems to be not easy to subclass properly. So I am trying to think outside the box here and think of other methods.

Example screenshot of current GUIDarkTheme UDF used on SampleControls.au3:

Spoiler

dark-GUI.png

I have thought about some things such as setting the SysDateTimePick32 control as a layer and setting a transparent color which can work, but leaves the text very grainy.

I was thinking about _WinAPI_InvertRgn most recently but not sure how exactly to use it. There aren't any previous examples in the forum either. I have stripped down a copy of SampleControls.au3 and got rid of most of the controls to help isolate SysDateTimePick32 if anyone wants to give it a try.

If _WinAPI_InvertRgn doesn't give any desired results, possibly we can try other ideas here in this thread.

; AutoIt GUI Example
; Created: 17/01/2005 - CyberSlug
; Modifed: 05/12/2011 - guinness
; Modifed: 09/06/2014 - mLipok
; Modifed: 15/10/2018 - mLipok

#Region INCLUDE
#include <GuiConstantsEx.au3>
#EndRegion INCLUDE

; set working directory to the original SampleControls example which contains the necessary resources
FileChangeDir(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) -1) & "\Examples\GUI")

#Region INITIALIZATION and EXIT
_Example()
Exit
; Finished!
#EndRegion INITIALIZATION and EXIT

Func _Example()
    #Region GUI
    Local $hGUI = GUICreate("Sample GUI", 400, 440)
    GUISetBkColor(0x202020)
    #EndRegion GUI

    #Region DATE
    GUICtrlCreateDate("", 5, 280, 200, 20)
    #EndRegion DATE

    #Region BUTTON
    Local $idButton = GUICtrlCreateButton("Sample Button", 10, 330, 100, 30)
    GUICtrlSetTip(-1, '#Region BUTTON')
    #EndRegion BUTTON

    #Region GUI MESSAGE LOOP

    ControlFocus($hGUI, "", $idButton)

    GUISetState(@SW_SHOW)
    
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd

    GUIDelete()
    #EndRegion GUI MESSAGE LOOP

EndFunc   ;==>_Example

 

Posted

Rgn is usually _WinAPI_CreateRectRgn() (or CreateRoundRectRgn), but somehow SysDateTimePick32 doesnt want to play along, also behaves weird like it's drawn from bottom up, as in X,Y pos is not the top left corner but the lower left corner.

Rgn works fine with SetWindowRgn but not with InvertRgn...

#Region DATE
    $hRgn = _WinAPI_CreateRectRgn(5, 300, 210, 330)
            _WinAPI_SetWindowRgn($hGui, $hRgn)
;~          _WinAPI_InvertRgn ($hGUI, $hRgn) ; <-- doesnt want to play along for some reason

    GUICtrlCreateDate("", 5, 280, 200, 20)
    #EndRegion DATE

 

Some guy's script + some other guy's script = my script!

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...