C#, 타이틀바 잡지 않고 윈도우 폼 이동하기

 

윈도우 폼을 마우스로 끌어 당기는 예제입니다.

 

 

 

 

 

 

 

소스

 

public partial class Form1 : Form

{

 

 

[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 Form1()

{

InitializeComponent();

}

 

private void Form1_MouseDown(object sender, MouseEventArgs e)

{

if(e.Button == MouseButtons.Left)

{

ReleaseCapture();

SendMessage(this.Handle, 0xA1, 2, 0);

}

}

}

 

 

 

+ Recent posts