protected void TextBoxValueChanged(object sender, EventArgs e) { CharBox triggeredBox = sender as CharBox; char matchingChar = triggeredBox.getChar(); int matchingIndex = matchingChar - 'A'; CharBox matchingBox = tableLayoutPanel1.Controls[matchingIndex] as CharBox; matchingBox.setChar(triggeredBox.getIndex()); triggeredBox.setBold(); matchingBox.setBold(); }
protected void TextBoxValueRemoved(object sender, EventArgs e) { CharBox triggeredBox = sender as CharBox; CharBox matchingBox = (CharBox)tableLayoutPanel1.Controls[0]; char triggeredIndex = triggeredBox.getIndex(); for (int i = 0; i < 26 && matchingBox.getChar() != triggeredIndex; i++) { matchingBox = (CharBox)tableLayoutPanel1.Controls[i]; } matchingBox.clearChar(); triggeredBox.ClearBold(); matchingBox.ClearBold(); }