Exemplo n.º 1
0
        private void DrawArrow(double X, double Y)
        {
            var screen = new Point(point.X + AppModel.Current.MaskLeftWidth, point.Y + AppModel.Current.MaskTopHeight);

            if (_Arrow == null)
            {
                _Arrow = new Path()
                {
                    Fill            = ArrowTool.Current.LineBrush,
                    StrokeThickness = ArrowTool.Current.LineThickness
                };
                Panel.SetZIndex(_Arrow, -1);
                MainWindow.AddControl(_Arrow);
            }
            var point2 = new Point(screen.X + X, screen.Y + Y);

            point2.X = point2.X <AppModel.Current.MaskLeftWidth?AppModel.Current.MaskLeftWidth : point2.X> AppModel.Current.MaskLeftWidth + Width ? AppModel.Current.MaskLeftWidth + Width : point2.X;
            point2.Y = point2.Y <AppModel.Current.MaskTopHeight?AppModel.Current.MaskTopHeight : point2.Y> AppModel.Current.MaskTopHeight + Height ? AppModel.Current.MaskTopHeight + Height : point2.Y;
            points   = ArrowTool.Current.CreateArrow(screen, point2);

            using (var ctx = geometry.Open())
            {
                for (int i = 0; i < points.Count; i++)
                {
                    if (i == 0)
                    {
                        ctx.BeginFigure(points[0], true, false);
                    }
                    else
                    {
                        ctx.LineTo(points[i], true, true);
                    }
                }
            }
            _Arrow.Data = geometry.Clone();
        }
Exemplo n.º 2
0
        IEventDataNode hotChunk; // Visual feedback on chunk under the mouse

        public EventDataBar()
        {
            this.Height             = 43;
            toolTip.PlacementTarget = this;
            this.Focusable          = true;

            this.axisPen          = CreateAndBindPen(1, AxisStrokeProperty);
            this.standardPen      = CreateAndBindPen(1, StrokeProperty);
            this.selectedPen      = CreateAndBindPen(0.5, SelectedStrokeProperty);
            this.highlightedPen   = CreateAndBindPen(0.5, HighlightedStrokeProperty);
            this.slicingMarkerPen = new Pen(Brushes.Black, .5);

            selectionArrowGeometry = new StreamGeometry()
            {
                FillRule = FillRule.EvenOdd
            };

            using (StreamGeometryContext ctx = selectionArrowGeometry.Open())
            {
                ctx.BeginFigure(new Point(0, 0), isFilled: true, isClosed: true);
                ctx.LineTo(new Point(3, -6), isStroked: true, isSmoothJoin: false);
                ctx.LineTo(new Point(-3, -6), isStroked: true, isSmoothJoin: false);
            }

            // The hot arrow needs its own geometry because it will have a different transform
            hotArrowGeometry = selectionArrowGeometry.Clone();

            DrawingBrush    unattributedBrush = new DrawingBrush();
            GeometryDrawing square            = new GeometryDrawing(Brushes.White, null, new RectangleGeometry(new Rect(0, 0, 10, 10)));
            GeometryDrawing line = new GeometryDrawing(null, slicingMarkerPen, new LineGeometry(new Point(0, 0), new Point(10, 10)));

            DrawingGroup drawingGroup = new DrawingGroup();

            drawingGroup.Children.Add(square);
            drawingGroup.Children.Add(line);

            unattributedBrush.Drawing       = drawingGroup;
            unattributedBrush.Viewport      = new Rect(0, 0, 10, 10);
            unattributedBrush.ViewportUnits = BrushMappingMode.Absolute;
            unattributedBrush.Viewbox       = new Rect(0, 0, 10, 10);
            unattributedBrush.ViewboxUnits  = BrushMappingMode.Absolute;
            unattributedBrush.TileMode      = TileMode.Tile;

            customBrushes[EventColor.UnattributedColor] = unattributedBrush;

            DrawingBrush systemProcessBrush = new DrawingBrush();

            square = new GeometryDrawing(Brushes.Black, null, new RectangleGeometry(new Rect(0, 0, 10, 10)));
            line   = new GeometryDrawing(null, new Pen(Brushes.White, 1), new LineGeometry(new Point(0, 0), new Point(10, 10)));

            drawingGroup = new DrawingGroup();
            drawingGroup.Children.Add(square);
            drawingGroup.Children.Add(line);

            systemProcessBrush.Drawing       = drawingGroup;
            systemProcessBrush.Viewport      = new Rect(0, 0, 10, 10);
            systemProcessBrush.ViewportUnits = BrushMappingMode.Absolute;
            systemProcessBrush.Viewbox       = new Rect(0, 0, 10, 10);
            systemProcessBrush.ViewboxUnits  = BrushMappingMode.Absolute;
            systemProcessBrush.TileMode      = TileMode.Tile;

            customBrushes[EventColor.SystemProcessColor] = systemProcessBrush;
        }