My plan is to create a single event that will go:
"Ok, the mouse entered a registered pictureBox, load X picture onto it according the name of sender."
What is the best way to handle this?
Should I create a dictionary with the name as key, and the location of the picture resource as the value?
Here's what I have so far:
private void SetPictureBoxEvents()
{
Andromeda.MouseEnter += new EventHandler(HeroMouseEnter);
Engineer.MouseEnter += new EventHandler(HeroMouseEnter);
Nighthound.MouseEnter += new EventHandler(HeroMouseEnter);
Swiftblade.MouseEnter += new EventHandler(HeroMouseEnter);
}
void HeroMouseEnter(object sender, EventArgs e)
{
//My picture box is named Andromeda. I'm going use that name
// as a key is a Dictionary and pull the picture according to the name.
//This is to make a generic event to handle all movements.
//Any help?
// ((PictureBox)sender).Image =
}
How could I also create a dictionary for image locations in my Resources.:
Dictionary<string, TestProject.Properties.Resources> HeroList
= new Dictionary<string, TestProject.Properties.Resources>();
This isn't working.