C# - change adjacent button colour when clicked
<p>OK let's say we have buttons arranged in the following form 5x5</p>

<pre><code>[11] [12] [13] [14] [15]
[21] [22] [23] [24] [25]
[31] [32] [33] [34] [35]
[41] [42] [43] [44] [45]
[51] [52] [53] [54] [55]
</code></pre>

<p>And want for example, if I click on button 34, to change the color of the button 24, 44, 33 and 35.
The problem is I do not know how to do that when I click on a button to return any of these values.
Take a pseudocode of what I want to do.</p>

<pre><code>When I press the button [i, j]:
Change color of button[i-1, j];
Change color of button[i +1, j];
Change color of button[i, j +1];
Change color of button[i, j-1];
</code></pre>

<p>So when I press a button, I need to somehow get the values ​​i, j of the button and I may handle other buttons on the same style (i +1, j, etc.)</p>

<p>I could treat separately each button.....</p>

<pre><code>private void button1_Click(object sender, EventArgs e)
{ // change colors
}
 private void button2_Click(object sender, EventArgs e)
{ // change colors
}
 private void button3_Click(object sender, EventArgs e)
{ // change colors
}
....
 private void button25_Click(object sender, EventArgs e)
{ // change colors
}
</code></pre>

<p>, .....but I have 25 buttons and I don't want to write the same code in all 25 keys.</p>

<p>What I want is that :</p>

<pre><code> private void button[i][j]_Click(object sender, EventArgs e)
{ 
 button[i+1][j].BackColor = Color.Red;
 button[i][j+1].BackColor ...... etc. etc.  
  // I know is incorrect, but is just how I want to act, if you understand me.
}
</code></pre>

<p>Excuse my bad English.</p>
