Hi,
I tried to create ellipse in a picturebox, but I don't know why the ellipse won't show.
Here is my code
private int iMouseX = 0;
private int iMouseY = 0;
City city;
List<City> cities = new List<City>();
private void picMapTour_MouseMove(object sender, MouseEventArgs e)
{
iMouseX = e.X;
iMouseY = e.Y;
}
private void picMapTour_MouseDown(object sender, MouseEventArgs e)
{
int x = iMouseX;
int y = iMouseY;
city = new City(x, y);
cities.Add(city);
this.Invalidate();
}
private void picMapTour_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
foreach (var city in cities)
{
g.FillEllipse(Brushes.Tan, (int)(city.X - 5), (int)(city.Y - 5), 10, 10);
g.DrawEllipse(Pens.Red, (int)(city.X - 5), (int)(city.Y - 5), 10, 10);
}
}Can anyone help me where is the problem in my code?
Many Thanks :)