Jayster2
Gebruiker
- Lid geworden
- 3 nov 2008
- Berichten
- 39
Ik kan mijn form niet dragen
[CPP]public partial class Form1 : Form
{
Point lastClick;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
lastClick = new Point(e.X, e.Y); //We'll need this for when the Form starts to move
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
//Point newLocation = new Point(e.X - lastE.X, e.Y - lastE.Y);
if (e.Button == MouseButtons.Left) //Only when mouse is clicked
{
//Move the Form the same difference the mouse cursor moved;
this.Left += e.X - lastClick.X;
this.Top += e.Y - lastClick.Y;
}
}[/CPP]
Werkt niet. Wat is de goede methode? Heb een aantal tutorials gevolgd maar ze werkten allemaal niet.
[CPP]public partial class Form1 : Form
{
Point lastClick;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
lastClick = new Point(e.X, e.Y); //We'll need this for when the Form starts to move
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
//Point newLocation = new Point(e.X - lastE.X, e.Y - lastE.Y);
if (e.Button == MouseButtons.Left) //Only when mouse is clicked
{
//Move the Form the same difference the mouse cursor moved;
this.Left += e.X - lastClick.X;
this.Top += e.Y - lastClick.Y;
}
}[/CPP]
Werkt niet. Wat is de goede methode? Heb een aantal tutorials gevolgd maar ze werkten allemaal niet.