private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } DmxFramework.Keyboard.Hotkey key = (DmxFramework.Keyboard.Hotkey) this.dataGridView1.Rows[e.RowIndex].Tag; DmxFramework.Keyboard.Action action = (DmxFramework.Keyboard.Action) this.dataGridView1.Rows[e.RowIndex].Cells[2].Tag; if (e.ColumnIndex == 4) { key.Actions.Remove(action); /*if (key.Actions.Count == 0) * { * Main.mFrameWork.KeyBord.Remove(key); * this.comboKey.rem * }*/ RefreshKeyTable((Hotkey)this.comboKey.SelectedItem); } else if (e.ColumnIndex == 3) { action.StopOnKeyUp = !(action.StopOnKeyUp); RefreshKeyTable((Hotkey)this.comboKey.SelectedItem); } }
private void RefreshKeyTable(DmxFramework.Keyboard.Hotkey pKey) { this.dataGridView1.Rows.Clear(); if (pKey == null) { return; } try { foreach (DmxFramework.Keyboard.Action action in pKey.Actions) { int index = this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[index].Tag = pKey; this.dataGridView1.Rows[index].Cells[0].Value = pKey.KeyCode; this.dataGridView1.Rows[index].Cells[1].Value = pKey.KeyValue; this.dataGridView1.Rows[index].Cells[2].Value = action.Path; this.dataGridView1.Rows[index].Cells[2].Tag = action; ((DataGridViewCheckBoxCell)this.dataGridView1.Rows[index].Cells[3]).Value = action.StopOnKeyUp; this.dataGridView1.Rows[index].Cells[4].Value = "Remove"; } } catch { } }
public void Remove(Hotkey pKey) { mHashTable.Remove(pKey.KeyValue); mKeyList.Remove(pKey); }