Gui +Resize - Caption Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Kanji
Posts: 4
Joined: 17 Feb 2020, 20:12

Gui +Resize - Caption

17 Feb 2020, 20:46

Hi everyone, sorry if this question is stupid or this topic has been already debated, but i searched and i didn't find anything :(
I'd like to remove the 6px white border created by the option +resize in the GUI when there's no title bar.
In the spoiler i added an image to let you understand what I'm talking about.
Spoiler

Code: Select all

Gui, -caption +resize MinSize400x200
Gui, Color, 000
Gui, Show, w100 h50, Nome
return
Last edited by Kanji on 18 Feb 2020, 08:16, edited 1 time in total.
scriptor2016
Posts: 854
Joined: 21 Dec 2015, 02:34

Re: Gui +Resize - Caption

17 Feb 2020, 23:50

Code: Select all

Gui, margin, -1, -1
Gui, -caption +resize MinSize400x200
Gui, Color, 000
Gui, Show, w100 h50, Nome
return
User avatar
flyingDman
Posts: 2817
Joined: 29 Sep 2013, 19:01

Re: Gui +Resize - Caption  Topic is solved

18 Feb 2020, 00:47

see here: https://autohotkey.com/board/topic/23969-resizable-window-border/

Code: Select all

OnMessage(0x84, "WM_NCHITTEST")
OnMessage(0x83, "WM_NCCALCSIZE")
gui, color, 000000
Gui, +resize MinSize200x200 maxsize400x400
Gui, Show, w300 h300
return

esc::
exitapp

WM_NCCALCSIZE()
{
    if A_Gui
        return 0    ; Sizes the client area to fill the entire window.
}

; Redefine where the sizing borders are.  This is necessary since
; returning 0 for WM_NCCALCSIZE effectively gives borders zero size.


WM_NCHITTEST(wParam, lParam)
{
    static border_size = 6
    
    if !A_Gui
        return
    
    WinGetPos, gX, gY, gW, gH
    
    x := lParam<<48>>48, y := lParam<<32>>48
    
    hit_left    := x <  gX+border_size
    hit_right   := x >= gX+gW-border_size
    hit_top     := y <  gY+border_size
    hit_bottom  := y >= gY+gH-border_size
    
    if hit_top
    {
        if hit_left
            return 0xD
        else if hit_right
            return 0xE
        else
            return 0xC
    }
    else if hit_bottom
    {
        if hit_left
            return 0x10
        else if hit_right
            return 0x11
        else
            return 0xF
    }
    else if hit_left
        return 0xA
    else if hit_right
        return 0xB
    
    ; else let default hit-testing be done
}
14.3 & 1.3.7
User avatar
Kanji
Posts: 4
Joined: 17 Feb 2020, 20:12

Re: Gui +Resize - Caption

18 Feb 2020, 08:23

flyingDman wrote:
18 Feb 2020, 00:47
see here: https://autohotkey.com/board/topic/23969-resizable-window-border/

Code: Select all

OnMessage(0x84, "WM_NCHITTEST")
OnMessage(0x83, "WM_NCCALCSIZE")
gui, color, 000000
Gui, +resize MinSize200x200 maxsize400x400
Gui, Show, w300 h300
return

esc::
exitapp

WM_NCCALCSIZE()
{
    if A_Gui
        return 0    ; Sizes the client area to fill the entire window.
}

; Redefine where the sizing borders are.  This is necessary since
; returning 0 for WM_NCCALCSIZE effectively gives borders zero size.


WM_NCHITTEST(wParam, lParam)
{
    static border_size = 6
    
    if !A_Gui
        return
    
    WinGetPos, gX, gY, gW, gH
    
    x := lParam<<48>>48, y := lParam<<32>>48
    
    hit_left    := x <  gX+border_size
    hit_right   := x >= gX+gW-border_size
    hit_top     := y <  gY+border_size
    hit_bottom  := y >= gY+gH-border_size
    
    if hit_top
    {
        if hit_left
            return 0xD
        else if hit_right
            return 0xE
        else
            return 0xC
    }
    else if hit_bottom
    {
        if hit_left
            return 0x10
        else if hit_right
            return 0x11
        else
            return 0xF
    }
    else if hit_left
        return 0xA
    else if hit_right
        return 0xB
    
    ; else let default hit-testing be done
}
Thank you, this is exactly what i was looking for :)
sanmaodo
Posts: 45
Joined: 28 Aug 2020, 01:39

Re: Gui +Resize - Caption

08 Mar 2022, 01:55

@flyingDman Thanks a lot, solved my big trouble.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Lamron750 and 358 guests