How to remove 'white area on the borderless window top side' builded Unity project

1

I am trying to make resizable borderless Unity project. I have no problem to make borderless window but when I try to make resizable it works however a white area appears at the top

https://imgur.com/8nNWpN3


    [DllImport("user32.dll")]
    private static extern int SetWindowLong(IntPtr hWnd, int nIndex, uint dwNewLong);


    private const int GWL_STYLE = -16;

    private const int SW_MINIMIZE = 6;
    private const int SW_MAXIMIZE = 3;
    private const int SW_RESTORE = 9;

    private const uint WS_VISIBLE = 0x10000000;
    private const uint WS_POPUP = 0x80000000;
    private const uint WS_BORDER = 0x00800000;
    private const uint WS_OVERLAPPED = 0x00000000;
    private const uint WS_CAPTION = 0x00C00000;
    private const uint WS_SYSMENU = 0x00080000;
    private const uint WS_THICKFRAME = 0x00040000; // WS_SIZEBOX
    private const uint WS_MINIMIZEBOX = 0x00020000;
    private const uint WS_MAXIMIZEBOX = 0x00010000;

    private const uint WS_OVERLAPPEDWINDOW =
        WS_OVERLAPPED |
        WS_CAPTION |
        WS_SYSMENU |
        WS_THICKFRAME |
        WS_MINIMIZEBOX |
        WS_MAXIMIZEBOX;


    public static void SetBorderActive(bool active)
    {
        var activeWindow = GetActiveWindow();

        if (active)
        {
            SetWindowLong(activeWindow, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE);
        }
        else
        {
            SetWindowLong(activeWindow, GWL_STYLE, WS_VISIBLE | WS_POPUP | WS_THICKFRAME );
        }

        Bordered = active;
    }

Here is mine resizable borderless window code

c#
windows
unity3d
user32
borderless

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0