How do you prevent a windows from being moved?

前端 未结 15 2052
刺人心
刺人心 2020-11-27 15:30

How would i go about stopping a form from being moved. I have the form border style set as FixedSingle and would like to keep it this way because it looks good in vista :)

15条回答
  •  我在风中等你
    2020-11-27 16:17

    I found this to stop the form from moving (its in c#)

    protected override void WndProc(ref Message m)
            {
                const int WM_SYSCOMMAND = 0x0112;
                const int SC_MOVE = 0xF010;
    
                switch (m.Msg)
                {
                    case WM_SYSCOMMAND:
                        int command = m.WParam.ToInt32() & 0xfff0;
                        if (command == SC_MOVE)
                            return;
                        break;
                }
                base.WndProc(ref m);
            }
    

    Found here

提交回复
热议问题