[Winform]프레임 없이 이동

2011. 11. 9. 15:25C#/WinForm

[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
public const int HT_CAPTION = 0x02;
public const int WM_NCLBUTTONDOWN = 0xA1;

protected override void 
OnMouseDown(System.Windows.Input.MouseButtonEventArgs e){

            ReleaseCapture();
            SendMessage(new System.Windows.Interop.WindowInteropHelper(this).Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}