Declare a Point class object in your form class
like this
private System.Drawing.Point LeftPoint;
and then implement the MouseDown and MouseMove events for your form like this.
private void AboutBox_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Left)
{
this.Left = this.Left+ e.X -LeftPoint.X;
this.Top = this.Top + e.Y - LeftPoint.Y;
}
}
private void AboutBox_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Left)
{
LeftPoint.X = e.X;
LeftPoint.Y = e.Y;
}
}
Although I'm not a strong believer of spoon feeding source code like this but the query was interesting so I wrote the code for you. Iâm sure if you had given it a try you would have been able to figure it out yourself.
Regards
Ankur Verma
.Net and C++ Specialist
Wiley Tech Support
|