0

hi all

i'm trying to draw an oval/ellipse over an existing square

the problem is that the oval is drawn behind the rectangle

how do i fix this?

here is my form's code

```
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;
namespace Quoridor
{
public partial class Game : Form
{
public const int N = 7;
GameNode[,] Mat = new GameNode[7,7];
public Game()
{
InitializeComponent();
for(int i=0;i<N;i++)
for(int j=0;j<N;j++)
{
Mat[i, j] = new GameNode();
Mat[i, j].pictureBox = new PictureBox();
// Mat[i, j].pictureBox.BorderStyle = BorderStyle.Fixed3D;
Mat[i, j].pictureBox.Location = new Point(10+i*50+i*10, 10+j*50+j*10);
Mat[i, j].pictureBox.BackColor = System.Drawing.Color.Salmon;
Mat[i, j].pictureBox.Size = new System.Drawing.Size(50, 50) ;
Mat[i, j].name = i.ToString() + j.ToString();
this.Controls.Add(Mat[i, j].pictureBox);
}
for(int i=0;i<N;i++)
for (int j = 0; j < N; j++)
{
if (i == 0)
{
if (j == 0)
{
Mat[i, j].rn = Mat[i, j + 1];
Mat[i, j].dn = Mat[i + 1, j];
}
else
if (j == 6)
{
Mat[i, j].ln = Mat[i, j - 1];
Mat[i, j].dn = Mat[i + 1, j];
}
else
{
Mat[i, j].rn = Mat[i, j + 1];
Mat[i, j].ln = Mat[i, j - 1];
Mat[i, j].dn = Mat[i + 1, j];
}
}
else
if (i == 6)
{
if (j == 0)
{
Mat[i, j].rn = Mat[i, j + 1];
Mat[i, j].un = Mat[i - 1, j];
}
else
if (j == 6)
{
Mat[i, j].ln = Mat[i, j - 1];
Mat[i, j].un = Mat[i - 1, j];
}
else
{
Mat[i, j].rn = Mat[i, j + 1];
Mat[i, j].ln = Mat[i, j - 1];
Mat[i, j].un = Mat[i - 1, j];
}
}
else
if ((j == 0) &&(i!=0) &&(i!=6)) {
Mat[i, j].rn = Mat[i, j + 1];
// Mat[i, j].ln = Mat[i, j - 1];
Mat[i, j].dn = Mat[i + 1, j];
}
else
if (j == 6)
{
// Mat[i, j].rn = Mat[i, j + 1];
Mat[i, j].ln = Mat[i, j - 1];
Mat[i, j].un = Mat[i - 1, j];
}
else
{
Mat[i, j].rn = Mat[i, j + 1];
Mat[i, j].ln = Mat[i, j - 1];
Mat[i, j].un = Mat[i - 1, j];
Mat[i, j].dn = Mat[i + 1, j];
}
}
private void Game_Load(object sender, EventArgs e)
{
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void pictureBox1_Click_1(object sender, EventArgs e)
{
}
private void Game_MouseHover(object sender, EventArgs e)
{
}
private void Game_MouseMove(object sender, MouseEventArgs e)
{
//label1.Text = e.X.ToString;
}
private void Game_Paint(object sender, PaintEventArgs e)
{
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red);
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.FillEllipse(myBrush, new Rectangle(0, 0, 200, 300));
}
}
}
```

*Edited
by severman*: n/a