SoFunction
Updated on 2025-03-07

C# How to change the size of the borderless form

protected override void WndProc(ref Message m)
{
    switch ()
    {
        case 0x0084:
            (ref m);
            Point vPoint = new Point((int) & 0xFFFF,
                (int) >> 16 & 0xFFFF);
            vPoint = PointToClient(vPoint);
            if ( <= 5)
                if ( <= 5)
                    = (IntPtr)HTTOPLEFT;
                else if ( >= - 5)
                    = (IntPtr)HTBOTTOMLEFT;
                else = (IntPtr)HTLEFT;
            else if ( >= - 5)
                if ( <= 5)
                    = (IntPtr)HTTOPRIGHT;
                else if ( >= - 5)
                    = (IntPtr)HTBOTTOMRIGHT;
                else = (IntPtr)HTRIGHT;
            else if ( <= 5)
                = (IntPtr)HTTOP;
            else if ( >= - 5)
                = (IntPtr)HTBOTTOM;
            break;
case 0x0201://the message pressed by the left mouse button
= 0x00A1;//Change the message to non-customer area and press the mouse
= ;//Default value
= new IntPtr(2);//Place the mouse in the title bar
            (ref m);
            break;
        default:
            (ref m);
            break;
    }
}