Ok, so I'm in the process of making a Tic-Tac-Toe game to help me learn C#. I'm attempting to add a bit of functionality to it, so I want people to be able to use the NumPad on a computer to simulate clicking the buttons.
Here is what I have but when I use the NumPad the buttons don't click. Can any of you see a reason as to why?
//===============================
// start NumPad Simulate Clicks
// NumPad MyButtons
// 7 8 9 1 2 3
// 4 5 6 4 5 6
// 1 2 3 7 8 9
//===============================
public void myControl_NumPad7(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.NumPad7)
{
button1_Click(null, null);
}
}
public void myControl_NumPad8(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.NumPad8)
{
button2_Click(null, null);
}
}
public void myControl_NumPad9(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.NumPad9)
{
button3_Click(null, null);
}
}
public void myControl_NumPad4(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.NumPad4)
{
button4_Click(null, null);
}
}
public void myControl_NumPad5(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.NumPad5)
{
button5_Click(null, null);
}
}
public void myControl_NumPad6(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.NumPad6)
{
button6_Click(null, null);
}
}
public void myControl_NumPad1(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.NumPad1)
{
button7_Click(null, null);
}
}
public void myControl_NumPad2(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.NumPad2)
{
button8_Click(null, null);
}
}
public void myControl_NumPad3(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.NumPad3)
{
button9_Click(null, null);
}
}