Exemplo n.º 1
0
 /// <summary>
 /// Handles mouse down on main panel. Creates rubbebanding shape
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void pnlPane_MouseDown(object sender, MouseEventArgs e)
 {
     pnlPane.Focus();
     mouseIsDown = true;
     mouseDown = e.Location;
     if (selectedTool == Tool.line)//Line takes different parameters
     {
         //Uses shapeTypes to get the shape type of selected tool
         newShape = (Shape)Activator.CreateInstance(shapeTypes[(int)selectedTool], cLine, lineWidth);
     }
     else
     {
         //Uses shapeTypes to get the shape type of selected tool
         newShape = (Shape)Activator.CreateInstance(shapeTypes[(int)selectedTool], cLine,cFill, lineWidth);
     }
     newShape.notFullDraw = true;
     newShape.startDraw(e);
 }
Exemplo n.º 2
0
 //Check for Ctrl+Z to remove last shape added
 private void frmPaint_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Z && e.Modifiers == Keys.Control && drawObjects.Count > 0 && !mouseIsDown)
     {
         drawObjects.RemoveAt(drawObjects.Count - 1);
         newShape = new Shape();
         mouseIsDown = false;
         pnlPane.Invalidate();
     }
 }