I have already found a solution with explanation posted by SA.
below is a working sample for reference
declare these variables globally
int _X, _Y;
bool _Drag = false;
declare these events on OnLoad
this.MouseUp += new MouseEventHandler(Form12_MouseUp);
this.MouseDown += new MouseEventHandler(Form12_MouseDown);
this.MouseMove += new MouseEventHandler(Form12_MouseMove);
code for events
void Form12_MouseMove(object sender, MouseEventArgs e)
{
if (_Drag == false)
return;
Point pCurent = Location;
Location = new Point(Location.X + e.X - _X, Location.Y + e.Y - _Y);
}
void Form12_MouseDown(object sender, MouseEventArgs e)
{
_Drag = true;
_X = e.X;
_Y = e.Y;
}
void Form12_MouseUp(object sender, MouseEventArgs e)
{
_Drag = false;
}
good luck ;-)