So I have a picture box that I need to draw rectangles or declare regions either or, so that the user can click on an area of the picture and it do something. I have searched and searched about this and have come to the conclusion that I do either need rectangles to target or a region. I really don't want a visible item over the map if that simplifies it, just a place for the user to click and it do an action.
On top of this the map will be changing and when it does I need to change the boxes to other locations. Below is what I came up with and its not working. I am open to other ways as well.
public Rectangle Location1;
public Rectangle Location2;
public String CharacterLocation == "WorldMap";
private void GenerateRegions ()
{
Pen blankPen = new Pen(Color.Transparent, 3);
if (CharacterLocation == "WorldMap")
{
Rectangle[] rects =
{
Location1 = new Rectangle(100, 200, 250, 50),
Location2 = new Rectangle(50, 100, 250, 50)
};
MapBox.CreateGraphics().DrawRectangles(blankPen, rects);
}
}
private void MapBox_MouseDown(object sender, MouseEventArgs e)
{
if (Location1.Contains(e.Location))
{
}
}
OK so here is what got it going for me. Its drawing the rectangles at the wrong spot, but I assume its cause the image is zoomed.
}