on mouse enter graphics C#

on mouse enter graphics C#

I am creating a game where you have to move around ellipses. If you touch
one you lose.
I can't get the code right for when your mouse is entering an ellipse.
Also, it would be nice if the ellipses moved around more and jumped of the
corners more rather than off the other ellipses.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int x1, x2, x3, x4, x5, x6 ,x7 ,x8, wid = 18,
y1,y2,y3,y4,y5,y6,y7,y8, speed = 5;
bool away= true;
int Counter = 0;
ArrayList arrX = new ArrayList();
ArrayList arrY = new ArrayList();
int X = 0;
int Y = 0;
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (x2 == 500)
away = false;
if (x2 == 250)
away = true;
IntPtr hWnd = FindWindow(null, "Form1");
RECT rc;
GetWindowRect(hWnd, out rc);
Rectangle rect = new Rectangle(rc.left, rc.top, rc.right, rc.bottom);
Point P = Cursor.Position;
if (rect.Contains(P))
{
timer1.Enabled = true;
X = Cursor.Position.X - rc.left - 8;
Y = Cursor.Position.Y - rc.top - 29;
label1.Text = ("x " + X.ToString() + " y " + Y.ToString());
}
else
{
timer1.Enabled = false;
}
if (arrX.Contains(X) && arrY.Contains(Y))
{
timer1.Enabled = false;
MessageBox.Show("Your score is " + Counter.ToString(),"You
lose!");
Counter = 0;
}
arrX.Clear();
arrY.Clear();
if (away)
{
x1 -= speed;
x2 += speed;
y1 -= speed;
y2 += speed;
x3 += speed;
x4 -= speed;
y5 += speed;
y6 -= speed;
x7 -= speed;
x8 += speed;
y7 += speed;
y8 -= speed;
arrY.Clear();
arrX.Clear();
arrX.Add(x1);
arrX.Add(x2);
arrX.Add(x3);
arrX.Add(x4);
arrX.Add(x5);
arrX.Add(x6);
arrX.Add(x7);
arrX.Add(x8);
arrY.Add(y1);
arrY.Add(y2);
arrY.Add(y3);
arrY.Add(y4);
arrY.Add(y5);
arrY.Add(y6);
arrY.Add(y7);
arrY.Add(y8);
}
else
{
x1 += speed;
x2 -= speed;
y1 += speed;
y2 -= speed;
x3 -= speed;
x4 += speed;
y5 -= speed;
y6 += speed;
x7 += speed;
x8 -= speed;
y7 -= speed;
y8 += speed;
arrY.Clear();
arrX.Clear();
arrX.Add(x1);
arrX.Add(x2);
arrX.Add(x3);
arrX.Add(x4);
arrX.Add(x5);
arrX.Add(x6);
arrX.Add(x7);
arrX.Add(x8);
arrY.Add(y1);
arrY.Add(y2);
arrY.Add(y3);
arrY.Add(y4);
arrY.Add(y5);
arrY.Add(y6);
arrY.Add(y7);
arrY.Add(y8);
}
Counter++;
Invalidate();
}
private void Form1_Load(object sender, EventArgs e)
{
x1 = Width / 2;
x2 = Width / 2;
x3 = Height / 2;
x4 = Height / 2;
x5 = (Width/2) - wid;
x6 = (Width/2) - wid;
x7 = Height - wid;
x8 = wid;
y1 = Width / 2;
y2 = Width / 2;
y3 = Height / 2;
y4 = Height / 2;
y5 = wid;
y6 = Width - wid;
y7 = wid;
y8 = Height - wid;
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.FillEllipse(Brushes.Red, x1, y1, wid, wid);
e.Graphics.FillEllipse(Brushes.Purple, x2, y2, wid, wid);
e.Graphics.FillEllipse(Brushes.Blue, x3, y3, wid, wid);
e.Graphics.FillEllipse(Brushes.Brown, x4, y4, wid, wid);
e.Graphics.FillEllipse(Brushes.Green, x5, y5, wid, wid);
e.Graphics.FillEllipse(Brushes.Black, x6, y6, wid, wid);
e.Graphics.FillEllipse(Brushes.Aqua, x7, y7, wid, wid);
e.Graphics.FillEllipse(Brushes.Yellow, x8, y8, wid, wid);
}
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string IpClassName, string IpWindowName);
[DllImport("user32.dll")]
public static extern int GetWindowRect(IntPtr hWnd, out RECT ipRect);
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
private void Form1_MouseEnter(object sender, EventArgs e)
{
timer1.Enabled = true;
Cursor.Position = new Point(340, 32);
}
private void pictureBox1_MouseEnter(object sender, EventArgs e)
{
timer1.Enabled = false;
MessageBox.Show("You made it to the next level");
MessageBox.Show("The speed will now be increased");
speed += 2;
timer1.Enabled = true;
}
}
}