Exemplo n.º 1
0
        private void StartDrawingRectROI()
        {
            ROIRect rectROI = new ROIRect();

            ROIList.Add(rectROI);
            rectROI.TopLeftPoint = rectROI.BottomRightPoint = MousePosition;
            rectROI.CaptureMouse();
            rectROI.CurrentState      = State.DrawingInProgress;
            rectROI.LastROIDrawEvent += OnGetLastDrawEventUpdated;
            SetBinding(MagnificationProperty.Name, rectROI, ROI.MagnificationProperty);
        }
Exemplo n.º 2
0
        private static void OnBottomRightChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ROIRect obj         = (ROIRect)d;
            Point   bottomRight = (Point)e.NewValue;
            Point   topRight    = obj.Anchors[TOP_RIGHT].Position;

            topRight.X = bottomRight.X;
            Point bottomLeft = obj.Anchors[BOTTOM_LEFT].Position;

            bottomLeft.Y = bottomRight.Y;
            Point center = obj.Anchors[CENTER].Position;

            center.X = (bottomRight.X + bottomLeft.X) / 2.0;
            center.Y = (bottomRight.Y + topRight.Y) / 2.0;
            obj.Anchors[TOP_RIGHT].Position    = topRight;
            obj.Anchors[BOTTOM_LEFT].Position  = bottomLeft;
            obj.Anchors[BOTTOM_RIGHT].Position = bottomRight;
            obj.Anchors[CENTER].Position       = center;
        }