Jump to content

Recommended Posts

Posted (edited)

Please test:

<code removed because test only>

Since I'm at home (vacation) I cannot properly test DPI behaviour, that's why I marked the size box in red to see if the scaling works correctly when the DPI is changed. Can somebody test and report?

Thanks.

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted
21 minutes ago, UEZ said:

Since I'm at home (vacation) I cannot properly test DPI behaviour, that's why I marked the size box in red to see if the scaling works correctly when the DPI is changed. Can somebody test and report?

It looks like the Edit control is aligned correctly but the ListView control sizebox seems misaligned by 1 pixel. Screenshot in spoiler below.

Spoiler

sizebox2.png

 

Posted

Can you please replace _PaintSizeBox() function with this and test it again?
 

Func _PaintSizeBox($hWnd, $hDC)
    Local $iWinStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)
    
    ; Only proceed if both horizontal and vertical scrollbars are active
    If Not (BitAND($iWinStyle, $WS_HSCROLL) And BitAND($iWinStyle, $WS_VSCROLL)) Then Return False

    ; 1. Retrieve exact Window and Client dimensions
    Local $tRW = _WinAPI_GetWindowRect($hWnd)
    Local $tRC = _WinAPI_GetClientRect($hWnd)
    
    ; 2. Map Client coordinates to Window-DC space
    Local $tPoint = DllStructCreate($tagPOINT)
    $tPoint.X = 0
    $tPoint.Y = 0
    _WinAPI_ClientToScreen($hWnd, $tPoint)

    ; Calculate border offsets
    Local $iOffL = $tPoint.X - $tRW.Left
    Local $iOffT = $tPoint.Y - $tRW.Top
    
    ; Calculate total window dimensions
    Local $iWinW = $tRW.Right - $tRW.Left
    Local $iWinH = $tRW.Bottom - $tRW.Top

    ; 3. Define the SizeBox Rect
    Local $tCorner = DllStructCreate($tagRECT)
    
    ; LEFT/TOP: Start exactly where the client area ends (scrollbar junction)
    $tCorner.Left   = $iOffL + $tRC.Right
    $tCorner.Top    = $iOffT + $tRC.Bottom
    
    ; RIGHT/BOTTOM: Align with the inner edge of the window border.
    $tCorner.Right  = $iWinW - $iOffL
    $tCorner.Bottom = $iWinH - $iOffT
    
    ; Adjust for ListView the size of the box
    If _WinAPI_GetClassName($hWnd) = "SysListView32" Then
        $tCorner.Right  += 1
        $tCorner.Bottom += 1
    EndIf

    ; 4. Paint the box using the dark theme color
    Local $hBrush = _WinAPI_CreateSolidBrush(_ColorToCOLORREF(0xF00000)) ;;$COLOR_TITLE_DARK
    _WinAPI_FillRect($hDC, $tCorner, $hBrush)
    _WinAPI_DeleteObject($hBrush)

    Return True
EndFunc   ;==>_PaintSizeBox

 

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted
20 minutes ago, UEZ said:

Can you please replace _PaintSizeBox() function with this and test it again?

Everything is sized and aligned perfectly. I tested on 100%, 125%, 150% and 175% and it was correct on all of the scaling settings that I was able to test.

The issue with the Edit box losing the overpaint when the cursor goes over is fixed as well. The whole thing with regard to sizebox overpainting is excellent now. :)

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