Could also use the API directly:
private const int WM_NCLBUTTONDOWN = 0xA1;
private const int HTCAPTION = 0x2;
[ DllImport( "user32.dll" ) ]
public static extern bool ReleaseCapture();
[ DllImport( "user32.dll" ) ]
public static extern int SendMessage( IntPtr hWnd, int Msg, int wParam, int
lParam );
public static void MoveForm( IntPtr Handle )
{
ReleaseCapture();
int Status = SendMessage( Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
}
....
Then call this MoveForm function however you'd want to trigger the form
moving, say by clicking and holding on a different control:
private void TitleBar_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
//simulate clicking on windows standard title bar
if (e.Button == MouseButtons.Left) MoveForm(this.Handle);
}
"Nikki" wrote:
Hi,
Can anybody help me in solving this problem. I m developing an
application in which the main application form is borderless. now i m
not able to move the application form with the help of mouse.
Thanks,