}// recognizeText #endregion #region delete /// <summary> /// Deletes the last object added to the slide /// </summary> /// <param name="allShapes">A list of all shapes on the slide</param> private void deleteLastObject(List <PowerPoint.Shape> allShapes) { if (allShapes.Count == 0) { setFeedback("There is no shape to be deleted"); } else { int rangeLength = allShapes.Count; PowerPoint.Shape shape = allShapes[rangeLength - 1]; // find the last added shape to the slide if (shape.Type == MsoShapeType.msoTextBox) { // for each textbox, get rid of the button / listbox associated with it ListBox listboxToDelete = findListboxFromTextbox(shape.Name); listboxToDelete.Hide(); stackDeleteTextbox(shape, listboxToDelete); // push both shape and the listbox onto the stack this.Controls.Remove(listboxToDelete); alternateList.Remove(listboxToDelete); clearButtons(); } else { stackDeleteShape(shape); } shape.Delete(); // if found, then this gesture deletes that shape setFeedback("Last added object deleted"); } }//deleteLastObject()
}//deleteLastObject() /// <summary> /// delete the object chose /// </summary> /// <param name="shape">the shape to be deleted</param> private void deleteChosenObject(PowerPoint.Shape shape) { if (shape == null) { setFeedback("No shape deleted - gesture must START on the shape to be deleted"); return; } if (shape.Type == MsoShapeType.msoTextBox) { // for each textbox, get rid of the button / listbox associated with it ListBox listboxToDelete = findListboxFromTextbox(shape.Name); listboxToDelete.Hide(); stackDeleteTextbox(shape, listboxToDelete); // push both shape and the listbox onto the stack this.Controls.Remove(listboxToDelete); alternateList.Remove(listboxToDelete); clearButtons(); } else { stackDeleteShape(shape); } shape.Delete(); setFeedback("Shape deleted"); }