コード例 #1
0
        void DrawLine(DrawingContext context, Point start, Point end, double distance, double time, bool mouseIsDown)
        {
            double speed        = distance / time;
            double penThickness = GetPenThickness(speed);

            Color           annotationColor = GetMouseAnnotationColor(mouseIsDown);
            SolidColorBrush arrowBrush      = CachedBrushes.Get(annotationColor);

            if (penThickness > distance)
            {
                context.DrawEllipse(arrowBrush, null, GetCenterPoint(start, end), penThickness / 2, penThickness / 2);
            }
            else
            {
                Pen arrowPen = new Pen(arrowBrush, penThickness);
                context.DrawLine(arrowPen, start, end);
            }
        }
コード例 #2
0
        public void AnnotateScreenshot(DrawingContext context, ScreenGrab screenGrab)
        {
            Point clientPt = screenGrab.ToClientPoint(position);

            Color           mouseAnnotationColor1 = Color.FromArgb(0xA0, 0xFF, 0x00, 0x00);
            SolidColorBrush annotationBrush       = CachedBrushes.Get(mouseAnnotationColor1);

            context.DrawEllipse(annotationBrush, null, clientPt, 2.5, 2.5);
            context.DrawEllipse(Brushes.Black, null, clientPt, 0.7, 0.7);

            Color           mouseAnnotationColor2 = Color.FromArgb(0x50, 0xFF, 0x00, 0x00);
            SolidColorBrush annotationBrush2      = CachedBrushes.Get(mouseAnnotationColor2);

            context.DrawEllipse(null, new Pen(annotationBrush2, 2), clientPt, 9, 9);

            Color           mouseAnnotationColor3 = Color.FromArgb(0x30, 0xFF, 0x00, 0x00);
            SolidColorBrush annotationBrush3      = CachedBrushes.Get(mouseAnnotationColor3);

            context.DrawEllipse(null, new Pen(annotationBrush3, 1), clientPt, 16, 16);
        }
コード例 #3
0
        public void AnnotateScreenshot(DrawingContext context, ScreenGrab screenGrab)
        {
            Point start = screenGrab.ToClientPoint(StartPosition);
            Point end   = screenGrab.ToClientPoint(EndPosition);

            bool mouseIsDownAtEnd = false;

            if (midPoints.Count > 1)
            {
                Point    thisPoint = start;
                DateTime thisTime  = Start;
                foreach (TimeMousePoint midPoint in midPoints)
                {
                    DateTime nextTime          = midPoint.Time;
                    TimeSpan timeBetweenPoints = nextTime - thisTime;
                    double   time      = timeBetweenPoints.TotalMilliseconds;
                    Point    nextPoint = screenGrab.ToClientPoint(midPoint.Point);
                    double   distance  = GetDistanceBetweenPoints(thisPoint, nextPoint);
                    if (thisPoint != nextPoint)
                    {
                        DrawLine(context, thisPoint, nextPoint, distance, time, midPoint.MouseIsDown);
                    }

                    if (mouseIsDownAtEnd != midPoint.MouseIsDown)
                    {
                        mouseIsDownAtEnd = midPoint.MouseIsDown;
                        double radius;
                        double thickness;
                        if (mouseIsDownAtEnd)
                        {
                            radius    = 6;
                            thickness = 2;
                        }
                        else
                        {
                            radius    = 6;
                            thickness = 1;
                        }
                        Color           annotationColor = GetMouseAnnotationColor(mouseIsDownAtEnd);
                        SolidColorBrush mouseDownBrush  = CachedBrushes.Get(annotationColor);
                        Pen             arrowPen        = new Pen(mouseDownBrush, thickness);
                        context.DrawEllipse(null, arrowPen, nextPoint, radius, radius);
                    }

                    thisPoint = nextPoint;
                    thisTime  = nextTime;
                }
            }
            else if (start != end)
            {
                TimeSpan timeBetweenPoints = Duration;
                double   time     = timeBetweenPoints.TotalMilliseconds;
                double   distance = GetDistanceBetweenPoints(startPosition, endPosition);
                DrawLine(context, start, end, distance, time, mouseStartsDown);
                mouseIsDownAtEnd = mouseStartsDown;
            }

            Color           lastEllipseColor = GetMouseAnnotationColor(mouseIsDownAtEnd);
            SolidColorBrush arrowBrush       = CachedBrushes.Get(lastEllipseColor);

            context.DrawEllipse(arrowBrush, null, end, 4, 4);
        }