Hi.
I created a borderless form and a MenuStrip docked on top of it that has a close and a minimize button.
How can I change form location when I drag that MenuStrip control?
Thanks :-)
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
FroglegPosted Feb 3, 2011, 1:53 AM
public partial class Form1 : Form
{
bool _mouseDown = false;
Point startPt;
public Form1()
{
InitializeComponent();
}
private void menuStrip1_MouseDown(object sender, MouseEventArgs e)
{
_mouseDown = true;
startPt = e.Location;
}
private void menuStrip1_MouseMove(object sender, MouseEventArgs e)
{
if (_mouseDown == true)
{
Point currentPos = PointToScreen(e.Location);
Location = new Point(currentPos.X - startPt.X, currentPos.Y - startPt.Y);
}
}
private void menuStrip1_MouseUp(object sender, MouseEventArgs e)
{
_mouseDown = false;
}
}
Suthish NairPosted Feb 3, 2011, 12:35 PM
good example..
Majid KamaliPosted Feb 3, 2011, 7:45 AM