Jump to content

_WinAPI_CreateWindowEx() - Set BgColor ?


Go to solution Solved by Andreik,

Recommended Posts

image.png.f1318a4ce3673b1f1e5acbf268229af7.png
 

#include <GUIConstants.au3>
#include <WinAPI.au3> ; for _WinAPI_CreateWindowEx()

Opt("MustDeclareVars", 1) ; example from "https://www.autoitscript.com/forum/topic/178961-resize-control/?do=findComment&comment=1336645"

Global Const $SBS_SIZEBOX = 0x08
Global Const $SBS_SIZEGRIP = 0x10

Global $hGui, $hSizebox

Example()

Func Example()
    Local $iW = 250, $iH = 50
    $hGui = GUICreate("Resize corner", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW)
    GUISetBkColor(0x00FF)

    Local $idResizeLabel = GUICtrlCreateLabel("", $iW - 20, $iH - 20, 22, 22)
    GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
    GUICtrlSetCursor(-1, 12)

    $hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, $iW - 20, $iH - 20, 20, 20, $hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP

    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUISetState()
    Local $iResize = 0
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $GUI_EVENT_PRIMARYUP
                If $iResize Then
                    $iResize = 0 ; restore the default mouse behaviour
                    GUISetCursor(2, 0, $hGui)
                    GUICtrlSetState($idResizeLabel, $GUI_SHOW)
                EndIf

            Case $idResizeLabel
                $iResize = 1
                GUICtrlSetState($idResizeLabel, $GUI_HIDE)
                GUISetCursor(12, 1, $hGui)
                MouseDown("MAIN") ; ..now that the Ctrl is hidden, nothing is held down, so we fake it ;)

        EndSwitch
    WEnd

    GUIDelete($hGui)
    Exit
EndFunc   ;==>Example

Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
    Local $aSize = WinGetClientSize($hGui)
    WinMove($hSizebox, "", $aSize[0] - 20, $aSize[1] - 20)
EndFunc   ;==>WM_SIZE

The question is: how do I color that CreateWindowEx ?

Thanks

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

You can do this but depending on your needs it would be more nice to register your own class and set the hbrBackground memeber of WNDCLASSEX structure.

#include <GUIConstants.au3>
#include <WinAPI.au3> ; for _WinAPI_CreateWindowEx()

Opt("MustDeclareVars", 1) ; example from "https://www.autoitscript.com/forum/topic/178961-resize-control/?do=findComment&comment=1336645"

Global Const $SBS_SIZEBOX = 0x08
Global Const $SBS_SIZEGRIP = 0x10

Global $hGui, $hSizebox, $hProc, $hOldProc, $hBrush

Example()

Func Example()
    Local $iW = 250, $iH = 50
    $hGui = GUICreate("Resize corner", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW)
    GUISetBkColor(0x00FF)

    Local $idResizeLabel = GUICtrlCreateLabel("", $iW - 20, $iH - 20, 22, 22)
    GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
    GUICtrlSetCursor(-1, 12)

    $hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, $iW - 20, $iH - 20, 20, 20, $hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP
    
    $hBrush = _WinAPI_CreateSolidBrush(0x000080)
    $hProc = DllCallbackRegister('ScrollbarProc', 'lresult', 'hwnd;uint;wparam;lparam')
    $hOldProc = _WinAPI_SetWindowLong($hSizebox, $GWL_WNDPROC, DllCallbackGetPtr($hProc))


    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUISetState()
    Local $iResize = 0
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $GUI_EVENT_PRIMARYUP
                If $iResize Then
                    $iResize = 0 ; restore the default mouse behaviour
                    GUISetCursor(2, 0, $hGui)
                    GUICtrlSetState($idResizeLabel, $GUI_SHOW)
                EndIf

            Case $idResizeLabel
                $iResize = 1
                GUICtrlSetState($idResizeLabel, $GUI_HIDE)
                GUISetCursor(12, 1, $hGui)
                MouseDown("MAIN") ; ..now that the Ctrl is hidden, nothing is held down, so we fake it ;)

        EndSwitch
    WEnd

    GUIDelete($hGui)

    _WinAPI_DeleteObject($hBrush)
    _WinAPI_SetWindowLong($hSizebox, $GWL_WNDPROC, $hOldProc)
    DllCallbackFree($hProc)

    Exit
EndFunc   ;==>Example

Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
    Local $aSize = WinGetClientSize($hGui)
    WinMove($hSizebox, "", $aSize[0] - 20, $aSize[1] - 20)
EndFunc   ;==>WM_SIZE

Func ScrollbarProc($hWnd, $iMsg, $wParam, $lParam)
    If $hWnd = $hSizebox Then
        Switch $iMsg
            Case $WM_ERASEBKGND
                Local $tRect = _WinAPI_GetClientRect($hWnd)
                _WinAPI_FillRect($wParam, $tRect, $hBrush)
                Return True
            Case $WM_PAINT
                Local $tPAINTSTRUCT
                Local $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT)
                Local $tRect = _WinAPI_CreateRect($tPAINTSTRUCT.Left, $tPAINTSTRUCT.Top, $tPAINTSTRUCT.Right, $tPAINTSTRUCT.Bottom)
                _WinAPI_FillRect($hDC, $tRect, $hBrush)
                _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT)
                Return 0
        EndSwitch
    EndIf
    Return _WinAPI_CallWindowProc($hOldProc, $hWnd, $iMsg, $wParam, $lParam)
EndFunc

 

When the words fail... music speaks.

Link to comment
Share on other sites

Posted (edited)

Now that's a step forward @Andreik. I'm looking to have something like this:
image.png.b1a662802882b67db12cfbb85ae7f10b.png

That's a big image :lol:
Maybe something with a label:

Local $idResizeLabel = GUICtrlCreateLabel("⠴", $iW - 20, $iH - 20, 20, 20, $SS_RIGHT)
    GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
    GUICtrlSetFont(-1, 16, 400, 0, "Segoe UI Symbol")
    GUICtrlSetCursor(-1, 12)

to fake the $SBS_SIZEBOX :) 

The $SBS_SIZEBOX does not resize nicely on a scale of 225% :( 
image.png.d9d0ed9de89b1e99ab5df58bd15c6d9e.png

Edited by argumentum
more

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • Solution
Posted (edited)

Like this?

#include <GUIConstants.au3>
#include <WinAPI.au3> ; for _WinAPI_CreateWindowEx()
#include <GDIPlus.au3>

Opt("MustDeclareVars", 1) ; example from "https://www.autoitscript.com/forum/topic/178961-resize-control/?do=findComment&comment=1336645"

Global Const $SBS_SIZEBOX = 0x08
Global Const $SBS_SIZEGRIP = 0x10

Global $hGui, $hSizebox, $hProc, $hOldProc, $hDots

Example()

Func Example()
    Local $iW = 250, $iH = 50
    $hGui = GUICreate("Resize corner", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW)
    GUISetBkColor(0x383838)

    Local $idResizeLabel = GUICtrlCreateLabel("", $iW - 20, $iH - 20, 22, 22)
    GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
    GUICtrlSetCursor(-1, 12)

    $hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, $iW - 20, $iH - 20, 20, 20, $hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP

    _GDIPlus_Startup()
    $hProc = DllCallbackRegister('ScrollbarProc', 'lresult', 'hwnd;uint;wparam;lparam')
    $hOldProc = _WinAPI_SetWindowLong($hSizebox, $GWL_WNDPROC, DllCallbackGetPtr($hProc))
    $hDots = CreateDots(20, 20, 0xFF383838, 0xFFBFBFBF)

    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUISetState()
    Local $iResize = 0
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $GUI_EVENT_PRIMARYUP
                If $iResize Then
                    $iResize = 0 ; restore the default mouse behaviour
                    GUISetCursor(2, 0, $hGui)
                    GUICtrlSetState($idResizeLabel, $GUI_SHOW)
                EndIf

            Case $idResizeLabel
                $iResize = 1
                GUICtrlSetState($idResizeLabel, $GUI_HIDE)
                GUISetCursor(12, 1, $hGui)
                MouseDown("MAIN") ; ..now that the Ctrl is hidden, nothing is held down, so we fake it ;)

        EndSwitch
    WEnd

    GUIDelete($hGui)

    _GDIPlus_BitmapDispose($hDots)
    _WinAPI_SetWindowLong($hSizebox, $GWL_WNDPROC, $hOldProc)
    DllCallbackFree($hProc)
    _GDIPlus_Shutdown()

    Exit
EndFunc   ;==>Example

Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
    Local $aSize = WinGetClientSize($hGui)
    WinMove($hSizebox, "", $aSize[0] - 20, $aSize[1] - 20)
EndFunc   ;==>WM_SIZE

Func ScrollbarProc($hWnd, $iMsg, $wParam, $lParam)
    If $hWnd = $hSizebox And $iMsg = $WM_PAINT Then
        Local $tPAINTSTRUCT
        Local $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT)
        Local $iWidth = DllStructGetData($tPAINTSTRUCT, 'rPaint', 3) - DllStructGetData($tPAINTSTRUCT, 'rPaint', 1)
        Local $iHeight = DllStructGetData($tPAINTSTRUCT, 'rPaint', 4) - DllStructGetData($tPAINTSTRUCT, 'rPaint', 2)
        Local $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC)
        _GDIPlus_GraphicsDrawImageRect($hGraphics, $hDots, 0, 0, $iWidth, $iHeight)
        _GDIPlus_GraphicsDispose($hGraphics)
        _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT)
        Return 0
    EndIf
    Return _WinAPI_CallWindowProc($hOldProc, $hWnd, $iMsg, $wParam, $lParam)
EndFunc

Func CreateDots($iWidth, $iHeight, $iBackgroundColor, $iDotsColor)
    Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
    Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    Local $hBrush = _GDIPlus_BrushCreateSolid($iDotsColor)
    _GDIPlus_GraphicsClear($hGraphics, $iBackgroundColor)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - 4, $iHeight - 12, 2, 2, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - 4, $iHeight - 8, 2, 2, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - 4, $iHeight - 4, 2, 2, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - 8, $iHeight - 8, 2, 2, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - 8, $iHeight - 4, 2, 2, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - 12, $iHeight - 4, 2, 2, $hBrush)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphics)
    Return $hBitmap
EndFunc

By the way, this definition for $tagPAINTSTRUCT must be changed from

Global Const $tagPAINTSTRUCT = 'hwnd hDC;int fErase;dword rPaint[4];int fRestore;int fIncUpdate;byte rgbReserved[32]'

to

Global Const $tagPAINTSTRUCT = 'hwnd hDC;int fErase;long Left;long Top;long Right;long Bottom;int fRestore;int fIncUpdate;byte rgbReserved[32]'

 

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

Yes !.
Could you make the dots proportional ?
If I make the Label 45x45, look the same but bigger ?

Am using HiDpi and dark mode code(s). Nothing that I could share because is just a big mess, but all it'd need is the proportional rendering   

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

That's just basic math but you must be aware that

$hSizebox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, $iW - 20, $iH - 20, 80, 80, $hGui)

won't really make your scrollbar 80 pixels height.

 

Edit: Your WM_SIZE tricked me.

 

Func CreateDots($iWidth, $iHeight, $iBackgroundColor, $iDotsColor)
    Local $iDotSize = Int($iHeight / 10)
    Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
    Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    Local $hBrush = _GDIPlus_BrushCreateSolid($iDotsColor)
    _GDIPlus_GraphicsClear($hGraphics, $iBackgroundColor)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 2), $iHeight - ($iDotSize * 6), $iDotSize, $iDotSize, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 2), $iHeight - ($iDotSize * 4), $iDotSize, $iDotSize, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 2), $iHeight - ($iDotSize * 2), $iDotSize, $iDotSize, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 4), $iHeight - ($iDotSize * 4), $iDotSize, $iDotSize, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 4), $iHeight - ($iDotSize * 2), $iDotSize, $iDotSize, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 6), $iHeight - ($iDotSize * 2), $iDotSize, $iDotSize, $hBrush)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphics)
    Return $hBitmap
EndFunc

 

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

Posted (edited)

Well, it does !

Spoiler
#include <GUIConstants.au3>
#include <WinAPI.au3> ; for _WinAPI_CreateWindowEx()
#include <GDIPlus.au3>

Opt("MustDeclareVars", 1) ; example from "https://www.autoitscript.com/forum/topic/178961-resize-control/?do=findComment&comment=1336645"

Global Const $SBS_SIZEBOX = 0x08
Global Const $SBS_SIZEGRIP = 0x10

Global $hGui
Global $g__ScrollbarSizeCorner_hSizeBox, $g__ScrollbarSizeCorner_hProc, $g__ScrollbarSizeCorner_OldProc, $g__ScrollbarSizeCorner_iResize = 0, _
     $g__ScrollbarSizeCorner_hDots, $g__ScrollbarSizeCorner_idLabel, $g__ScrollbarSizeCorner_iBoxSize = 80  ; <--- it works quite nice

Example() ; https://www.autoitscript.com/forum/topic/211606-_winapi_createwindowex-set-bgcolor/?do=findComment&comment=1531068

Func Example()
    Local $iW = 250, $iH = 90
    $hGui = GUICreate("Resize corner", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW)

    GUISetBkColor(0x383838)
    ScrollbarDots_Create(0x383838, 0xBFBFBF)

    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUIRegisterMsg($WM_MOVE, "WM_MOVE")
    GUISetState()

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $GUI_EVENT_PRIMARYUP
                ScrollbarDots_OnPrimaryUp()

            Case $g__ScrollbarSizeCorner_idLabel
                ScrollbarDots_OnClickLabel()

        EndSwitch
    WEnd

    GUIDelete($hGui)
    ScrollbarDots_Cleanup()
    Exit
EndFunc   ;==>Example

Func ScrollbarDots_OnClickLabel()
    $g__ScrollbarSizeCorner_iResize = 1
    GUICtrlSetState($g__ScrollbarSizeCorner_idLabel, $GUI_HIDE)
    GUISetCursor(12, 1, $hGui)
    MouseDown("MAIN") ; ..now that the Ctrl is hidden, nothing is held down, so we fake it ;)
EndFunc

Func ScrollbarDots_OnPrimaryUp()
    If Not $g__ScrollbarSizeCorner_iResize Then Return
    $g__ScrollbarSizeCorner_iResize = 0 ; restore the default mouse behaviour
    GUISetCursor(2, 0, $hGui)
    GUICtrlSetState($g__ScrollbarSizeCorner_idLabel, $GUI_SHOW)
    _WinAPI_RedrawWindow($g__ScrollbarSizeCorner_hSizeBox)
EndFunc

Func ScrollbarDots_Create($bgColor, $fgColor, $iW = 100, $iH = 100) ; $iW & $iH are irrelevant as WM_SIZE will place them accordingly
    $bgColor = 0xFF000000 + $bgColor
    $fgColor = 0xFF000000 + $fgColor
    $g__ScrollbarSizeCorner_idLabel = GUICtrlCreateLabel("", $iW - $g__ScrollbarSizeCorner_iBoxSize + 2, _
        $iH - $g__ScrollbarSizeCorner_iBoxSize + 2, $g__ScrollbarSizeCorner_iBoxSize, $g__ScrollbarSizeCorner_iBoxSize)
    GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
    GUICtrlSetCursor(-1, 12)
    $g__ScrollbarSizeCorner_hSizeBox = _WinAPI_CreateWindowEx(0, "Scrollbar", "", _
        $WS_CHILD + $WS_VISIBLE + $SBS_SIZEBOX, $iW - $g__ScrollbarSizeCorner_iBoxSize, _
        $iH - $g__ScrollbarSizeCorner_iBoxSize, $g__ScrollbarSizeCorner_iBoxSize, _
        $g__ScrollbarSizeCorner_iBoxSize, $hGui) ; $SBS_SIZEBOX or $SBS_SIZEGRIP
    _GDIPlus_Startup()
    $g__ScrollbarSizeCorner_hProc = DllCallbackRegister('ScrollbarProc', 'lresult', 'hwnd;uint;wparam;lparam')
    $g__ScrollbarSizeCorner_OldProc = _WinAPI_SetWindowLong($g__ScrollbarSizeCorner_hSizeBox, $GWL_WNDPROC, DllCallbackGetPtr($g__ScrollbarSizeCorner_hProc))
    $g__ScrollbarSizeCorner_hDots = CreateDots($g__ScrollbarSizeCorner_iBoxSize, $g__ScrollbarSizeCorner_iBoxSize, $bgColor, $fgColor)
EndFunc

Func ScrollbarDots_Cleanup()
    _GDIPlus_BitmapDispose($g__ScrollbarSizeCorner_hDots)
    _WinAPI_SetWindowLong($g__ScrollbarSizeCorner_hSizeBox, $GWL_WNDPROC, $g__ScrollbarSizeCorner_OldProc)
    DllCallbackFree($g__ScrollbarSizeCorner_hProc)
    _GDIPlus_Shutdown()
EndFunc

Func WM_MOVE($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    _WinAPI_RedrawWindow($g__ScrollbarSizeCorner_hSizeBox)
EndFunc

Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    Local $aSize = WinGetClientSize($hGui)
    If Not @error Then WinMove($g__ScrollbarSizeCorner_hSizeBox, "", $aSize[0] - $g__ScrollbarSizeCorner_iBoxSize, $aSize[1] - $g__ScrollbarSizeCorner_iBoxSize)
EndFunc   ;==>WM_SIZE

Func ScrollbarProc($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    If $hWnd = $g__ScrollbarSizeCorner_hSizeBox And $iMsg = $WM_PAINT Then
        Local $tPAINTSTRUCT
        Local $hDC = _WinAPI_BeginPaint($hWnd, $tPAINTSTRUCT)
        Local $iWidth = DllStructGetData($tPAINTSTRUCT, 'rPaint', 3) - DllStructGetData($tPAINTSTRUCT, 'rPaint', 1)
        Local $iHeight = DllStructGetData($tPAINTSTRUCT, 'rPaint', 4) - DllStructGetData($tPAINTSTRUCT, 'rPaint', 2)
        Local $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC)
        _GDIPlus_GraphicsDrawImageRect($hGraphics, $g__ScrollbarSizeCorner_hDots, 0, 0, $iWidth, $iHeight)
        _GDIPlus_GraphicsDispose($hGraphics)
        _WinAPI_EndPaint($hWnd, $tPAINTSTRUCT)
        Return True
    EndIf
    Return _WinAPI_CallWindowProc($g__ScrollbarSizeCorner_OldProc, $hWnd, $iMsg, $wParam, $lParam)
EndFunc   ;==>ScrollbarProc

Func CreateDots($iWidth, $iHeight, $iBackgroundColor, $iDotsColor)
    Local $iDotSize = Int($iHeight / 10)
    Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
    Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    Local $hBrush = _GDIPlus_BrushCreateSolid($iDotsColor)
    _GDIPlus_GraphicsClear($hGraphics, $iBackgroundColor)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 2), $iHeight - ($iDotSize * 6), $iDotSize, $iDotSize, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 2), $iHeight - ($iDotSize * 4), $iDotSize, $iDotSize, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 2), $iHeight - ($iDotSize * 2), $iDotSize, $iDotSize, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 4), $iHeight - ($iDotSize * 4), $iDotSize, $iDotSize, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 4), $iHeight - ($iDotSize * 2), $iDotSize, $iDotSize, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $iWidth - ($iDotSize * 6), $iHeight - ($iDotSize * 2), $iDotSize, $iDotSize, $hBrush)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphics)
    Return $hBitmap
EndFunc   ;==>CreateDots

 

image.png.634d4d494fceacbc3fcf3aaa3447e370.png

Edited by argumentum
refactored code

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

Noticed that if you move the main window outside the desktop and then move it back to current desktop, it's not always painted in time so you might want to force a redraw when the main window is moved.

Func WM_MOVE($hWnd, $iMsg, $wParam, $lParam)
    _WinAPI_RedrawWindow($hSizebox)
EndFunc

 

When the words fail... music speaks.

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...