How to drag your form when “formBorderStyle” was set “none”?

just use 3-M …

Add 3 events MouseDown – MouseUp & MouseMove.

declare :

Boolean flag;
int x, y;

MouseDown function:

flag = true;
x = e.X;
y = e.Y;

MouseUp function:

flag = false;

MouseMove function:

if (flag)
{
this.SetDesktopLocation(Cursor.Position.X – x, Cursor.Position.Y – y);
}

or another solution:


using System.Runtime.InteropServices;

public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;

[DllImportAttribute("user32.dll")]
private static extern int SendMessage(IntPtr hWnd,
int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
private static extern bool ReleaseCapture();

public Form1()
{
InitializeComponent();
}

private void menuStrip1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
}