Answer the question
In order to leave comments, you need to log in
How to implement click on objects in WinForm in picturebox via coordinates?
there is a class:
class MapObject
{
public string Name;
public int X;
public int Y;
public int Width;
public int Height;
}
public Form4()
{
InitializeComponent();
objects = new List<MapObject>();
objects.Add(new MapObject()
{
Name = "Парусник",
X = 193,
Y = 35,
Width = 32,
Height = 40
});
}
List<MapObject> objects;
private void pictureBox4_MouseClick(object sender, MouseEventArgs e)
{
int currentX = e.X;
int currentY = e.Y;
for (int i = 0; i < objects.Count; i++)
{
objects[i].X
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question