private void TopCanvas_MouseDown(object sender, MouseButtonEventArgs e) { if (this.imageCanvas.OpenfileName != "") { Point pnt = e.GetPosition(sender as Canvas); if (pnt.X > 0 && pnt.X < imageBorder.ActualWidth && pnt.Y > imageBorder.ActualHeight - imageBorder.BorderThickness.Bottom - dsize && pnt.Y <= imageBorder.ActualHeight + dsize) { oldDraw = drawingDirect.currentDrawing; drawingDirect.currentDrawing = null; if (pnt.X > imageBorder.ActualWidth - 20) { dragArea = DragBorder.XY; } else { dragArea = DragBorder.Y; } } else if (pnt.Y > 0 && pnt.Y < imageBorder.ActualHeight && pnt.X > imageBorder.ActualWidth - imageBorder.BorderThickness.Right - dsize && pnt.X <= imageBorder.ActualWidth + dsize) { oldDraw = drawingDirect.currentDrawing; drawingDirect.currentDrawing = null; if (pnt.Y > imageBorder.ActualHeight - 20) { dragArea = DragBorder.XY; } else { dragArea = DragBorder.X; } } e.Handled = true; } }
private void TopCanvas_MouseUp(object sender, MouseButtonEventArgs e) { if (this.imageCanvas.OpenfileName != "") { dragArea = DragBorder.None; } if (this.drawingDirect.currentDrawing == null && oldDraw != null) { drawingDirect.SetDrawing(oldDraw); oldDraw = null; } }