private static void OnRadiusYChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ROIOval obj = (ROIOval)d; double radius = (double)e.NewValue; Point center = obj.Anchors[CENTER].Position; obj.Anchors[TOP].Position = new Point(center.X, center.Y - radius);; obj.Anchors[BOTTOM].Position = new Point(center.X, center.Y + radius);; }
private static void OnRadiusXChanged(DependencyObject d, DependencyPropertyChangedEventArgs r) { ROIOval obj = (ROIOval)d; double radius = (double)r.NewValue; Point center = obj.Anchors[CENTER].Position; obj.Anchors[LEFT].Position = new Point(center.X - radius, center.Y); obj.Anchors[RIGHT].Position = new Point(center.X + radius, center.Y); }
private void StartDrawingOvalROI() { ROIOval ovalROI = new ROIOval(); ROIList.Add(ovalROI); ovalROI.Center = MousePosition; ovalROI.CaptureMouse(); ovalROI.CurrentState = State.DrawingInProgress; ovalROI.LastROIDrawEvent += OnGetLastDrawEventUpdated; SetBinding(MagnificationProperty.Name, ovalROI, ROI.MagnificationProperty); }
private static void OnCenterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ROIOval roiOval = (ROIOval)d; Point center = (Point)e.NewValue; roiOval.Anchors[TOP].Position = new Point(center.X, center.Y - roiOval.RadiusY); roiOval.Anchors[BOTTOM].Position = new Point(center.X, center.Y + roiOval.RadiusY); roiOval.Anchors[LEFT].Position = new Point(center.X - roiOval.RadiusX, center.Y); roiOval.Anchors[RIGHT].Position = new Point(center.X + roiOval.RadiusX, center.Y);; roiOval.Anchors[CENTER].Position = center; }