0

It seems like my script is not being executed. I created my own exit button, pressed on "view code" and added this line:

public void leaveButton_Click ( object sender, EventArgs e )
{
    this.Close();
}

I tried the same with:

Application.Exit();

I thought that it might just not work on an image (which it actually should?) so I created a button with the same function... The same result; nothing. I ignored it for the first part and looked for some different lines to add. My borders are set to none but I still wanted it to be movable. So I added this:

    private bool mouseDown;
    private Point lastLocation;

    private void Form1_MouseDown(object sender, MouseEventArgs e)
    {
        mouseDown = true;
        lastLocation = e.Location;
    }

    private void Form1_MouseMove(object sender, MouseEventArgs e)
    {
        if (mouseDown)
        {
            this.Location = new Point(
                (this.Location.X - lastLocation.X) + e.X, (this.Location.Y - lastLocation.Y) + e.Y);

            this.Update();
        }
    }

    private void Form1_MouseUp(object sender, MouseEventArgs e)
    {
        mouseDown = false;
    }

I do not truly understand it so there might be an error in it. It does nothing.

LuaEden X
  • 21
  • 1
  • 2
  • It is strange. Something is missing with your question to understand the problem and the blocking. Have you tried `Environment.Exit(0);` ? –  Oct 27 '19 at 10:17
  • 1
    Ok, you *added this line*. But did you also subscribe to the event(s)? – Jimi Oct 27 '19 at 10:33

0 Answers0