Handling of forms c #

1

I have a menu and some child forms ... and I want them not to be able to click on the form and drag, as I do? I want it to stay in the position and size that I put.

    
asked by anonymous 27.06.2015 / 23:46

1 answer

1

This locks the form and does not allow resizing, otherwise disable the MaximizeBox property, set it to false to lock the maximize button on the form

o to block movement grab this code and paste it into the form code

 protected override void WndProc(ref Message message)
        {
            const int WM_SYSCOMMAND = 0x0112;
            const int SC_MOVE = 0xF010;

            switch (message.Msg)
            {
                case WM_SYSCOMMAND:
                    int command = message.WParam.ToInt32() & 0xfff0;
                    if (command == SC_MOVE)
                        return;
                    break;
            }

            base.WndProc(ref message);
        }
    
28.06.2015 / 00:15