Hi,
I have some question to ask because I don't understand why is it happening like that.
I have 2 polygon created and displayed.I've make mouseDown, mouseUp, mouseMove event. (For some movement for the polygon)Now i wanted to implement keyUp(pressing delete button from keyboard, then delete the polygon)
This is the code for MouseUp:
private void Shape_MouseUp(object sender, MouseEventArgs e) { isDraggingA = false; controlALL = (Control)sender;
if (e.Button == MouseButtons.Left) { OB = sender; controlALL.KeyUp += new KeyEventHandler(DeleteButton); } }
the " object sender " is to identify which polygon I've selectedthen, I've made "Shape_MouseUp" it so that it will run "DeleteButton" function
Below is my DeleteButton code:
private void DeleteButton(object sender, KeyEventArgs e) {
controlALL = (Control)OB;
if (e.KeyCode == Keys.Delete) { controlALL.Dispose(); }
}
PROBLEM : When i execute this 2 code, the result i got is,
when i click on polygon 1, then press 'delete' SUCCESSBut when i click on polygon 2, then press 'delete' NOTHING HAPPEN
I don't know why the function "DeleteButton(object sender, KeyEventArgs e) cannot get the polygon 2.Any idea?