private void fillContetnBoxOkButtonClick(object sender, RoutedEventArgs e) { Console.WriteLine("123"); RemarkRectangleNode rectangleNode = rectangleNodes.Last(); rectangleNodes.RemoveAt(rectangleNodes.Count - 1); rectangleNode.name = fillContentBox.name; rectangleNodes.Add(rectangleNode); Rectangle rectangle = rectangles.Last(); rectangle.Stroke = GetRemartRectangleColorByTermNumber(fillContentBox.termNumber); ImageCanvas.Children.Remove(fillContentBox); fillContentBox = null; }
private void ImageLeft_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { var img = sender as ContentControl; if (img == null) { return; } Point positoin = e.GetPosition(img); this.Cursor = System.Windows.Input.Cursors.Arrow; img.ReleaseMouseCapture(); IsMouseLeftButtonDown = false; if (isRemarking) { Rectangle rectangle = rectangles.Last(); if (rectangle != null && (rectangle.Width > 0 || rectangle.Height > 0)) { //存储每个标记框的坐标 RemarkRectangleNode rectangleNode = new RemarkRectangleNode(); rectangleNode.xmin = (int)RemarkRectanglePoint.X; rectangleNode.ymin = (int)RemarkRectanglePoint.Y; rectangleNode.xmax = rectangleNode.xmin + (int)rectangle.Width; rectangleNode.ymax = rectangleNode.ymin + (int)rectangle.Height; rectangleNodes.Add(rectangleNode); fillContentBox = new FillContentBox(); fillContentBox.okButton.Click += new RoutedEventHandler(fillContetnBoxOkButtonClick); fillContentBox.cancelButton.Click += new RoutedEventHandler(fillContetnBoxCancelButtonClick); ImageCanvas.Children.Add(fillContentBox); Canvas.SetLeft(fillContentBox, 500); Canvas.SetTop(fillContentBox, rectangleNode.ymax + 30); } else if (rectangle != null) { rectangles.Remove(rectangle); } } }