當前位置: 首頁>>代碼示例>>C#>>正文


C# StreamGeometry.Clone方法代碼示例

本文整理匯總了C#中System.Windows.Media.StreamGeometry.Clone方法的典型用法代碼示例。如果您正苦於以下問題:C# StreamGeometry.Clone方法的具體用法?C# StreamGeometry.Clone怎麽用?C# StreamGeometry.Clone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Media.StreamGeometry的用法示例。


在下文中一共展示了StreamGeometry.Clone方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: EventDataBar

        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;
        }
開發者ID:UnaNancyOwen,項目名稱:Kinect-Studio-Sample,代碼行數:63,代碼來源:EventDataBar.cs


注:本文中的System.Windows.Media.StreamGeometry.Clone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。