private void FrmMain_KeyDown(object sender, KeyEventArgs e) { IsCTRL_pressed = e.Control; lblGroup.Tag = false; GetFocus(lblGroup, false); pnlPaint.Focus(); switch (e.KeyCode) { case Keys.Delete: case Keys.Back: for (int i = 0; i < DrawObj.Count; i++) { if (DrawObj[i].IsSelected) { DrawObj.RemoveAt(i--); } } break; case Keys.A: if (IsCTRL_pressed) { GetFocus(lblSelect, true); CurrentACTION = ACTION.SELECT; DrawObj.ForEach(shape => shape.IsSelected = true); } break; } RePaint(); }
private bool Group() { if (DrawObj.Count(shape => shape.IsSelected) > 1) { Group group = new Group(); for (int i = 0; i < DrawObj.Count; i++) { if (DrawObj[i].IsSelected) { group.Add(DrawObj[i]); DrawObj.RemoveAt(i--); } } group.IsSelected = true; DrawObj.Add(group); return(true); } else { return(false); } }