przesuwanie okienka

0

Ustawiłem w Properties, FormBorderStyle na None i chce teraz zrobić, aby moje okienko można było przesuwać po całym pulpicie. Jak to zrobić?

0
using System.Runtime.InteropServices;

...

        [DllImport("user32.dll", SetLastError=true)]
        static extern bool ReleaseCapture();

        [DllImport("user32.dll", SetLastError=true)]
        static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);

        const int WM_NCLBUTTONDOWN = 161;
        const int HTCAPTION = 2;

        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button==MouseButtons.Left)
            {
                ReleaseCapture();
                SendMessage(Handle,WM_NCLBUTTONDOWN,(IntPtr)HTCAPTION,IntPtr.Zero);
            }
        }

1 użytkowników online, w tym zalogowanych: 0, gości: 1