当前位置: 首页>>代码示例>>C#>>正文


C# Shapes.Line类代码示例

本文整理汇总了C#中System.Windows.Shapes.Line的典型用法代码示例。如果您正苦于以下问题:C# Line类的具体用法?C# Line怎么用?C# Line使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Line类属于System.Windows.Shapes命名空间,在下文中一共展示了Line类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddActor

        public void AddActor(string name)
        {
            var header = new Border
            {
                BorderBrush = Brushes.Black,
                BorderThickness = new Thickness(1),
                Margin = new Thickness(5),
                CornerRadius = new CornerRadius(3),
                Padding = new Thickness(15, 2, 15, 2),
                Child = new TextBlock { Text = name },
                SnapsToDevicePixels = true,
            };
            SeqDiagPanel.SetPosition(header,
                Position.OneColumn(_column, 0));
            LayoutRoot.Children.Add(header);

            var line = new Line
            {
                StrokeThickness = 1,
                Y1 = 0,
                Y2 = 75,
                X1 = 0,
                X2 = 0,
                MinHeight = 75,
                Stroke = Brushes.Black,
                Stretch = Stretch.Fill,
                SnapsToDevicePixels = true,
            };
            SeqDiagPanel.SetPosition(line, Position.Body(_column));
            LayoutRoot.Children.Add(line);
            _column++;
        }
开发者ID:marhoily,项目名称:TextToSeqDiag,代码行数:32,代码来源:SequenceDiagram.cs

示例2: GetGraphics

        public override GraphicsResult GetGraphics(IWpfTextView view, Geometry geometry)
        {
            Initialize(view);

            // We clip off a bit off the start of the line to prevent a half-square being
            // drawn.
            var clipRectangle = geometry.Bounds;
            clipRectangle.Offset(1, 0);

            var line = new Line
            {
                X1 = geometry.Bounds.Left,
                Y1 = geometry.Bounds.Bottom - s_pen.Thickness,
                X2 = geometry.Bounds.Right,
                Y2 = geometry.Bounds.Bottom - s_pen.Thickness,
                Clip = new RectangleGeometry { Rect = clipRectangle }
            };
            // RenderOptions.SetEdgeMode(line, EdgeMode.Aliased);

            ApplyPen(line, s_pen);

            // Shift the line over to offset the clipping we did.
            line.RenderTransform = new TranslateTransform(-s_pen.Thickness, 0);
            return new GraphicsResult(line, null);
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:25,代码来源:SuggestionTag.cs

示例3: Show

		public override double Show(Score score, Staff trebleStaff, Staff bassStaff, double left)
		{
			foreach (Staff staff in new[] { trebleStaff, bassStaff })
			{
				double top = staff.top * score.Magnification;
				UIElement barLine = new Line
				{
					X1 = left,
					X2 = left,
					Y1 = top,
					Y2 = top + Staff.spaceBetweenLines * 4 * score.Magnification,
					Stroke = Brushes.Black,
					StrokeThickness = 1
				};
				base.AddElement(score, barLine);
				//score.Children.Add(barLine);
				//base.elements.Add(barLine);
			}

			double right = left + 1;

			// Czy znak zmieścił sie na pięcolinii?
			if (right >= score.ActualWidth - Staff.marginLeft)
			{
				// Nie zmieścił się - narysujemy ją na następnej pieciolinii.
				Hide(score);

				return -1;
			}

			right = left + 1 + Staff.spaceBetweenSigns * score.Magnification;

			return right;
		}
开发者ID:paszczaczek,项目名称:Nutadore,代码行数:34,代码来源:Bar.cs

示例4: GenerateLegendLines

 public static void GenerateLegendLines(this Canvas canvas, IEnumerable<DataSeries> dataList, double textHeight, double lineLength)
 {
     const double sx = 6;
     const double sy = 0;
     int n = 1;
     double xText = 2 * sx + lineLength;
     foreach (DataSeries ds in dataList)
     {
         double yText = n * sy + (2 * n - 1) * textHeight / 2;
         Line line = new Line
         {
             X1 = sx,
             Y1 = yText,
             X2 = sx + lineLength,
             Y2 = yText
         };
         ds.AddLinePattern(line);
         canvas.Children.Add(line);
         ds.Symbols.AddSymbol(canvas, new Point(0.5 * (line.X2 - line.X1 + ds.Symbols.SymbolSize) + 1, line.Y1));
         TextBlock tb = new TextBlock { Text = ds.SeriesName };
         canvas.Children.Add(tb);
         Canvas.SetTop(tb, yText - textHeight / 2);
         Canvas.SetLeft(tb, xText);
         n++;
     }
 }
开发者ID:ouyh18,项目名称:LteTools,代码行数:26,代码来源:CanvasOperations.cs

示例5: DrawIcon

        /// <summary>
        /// Draws the icon to display.
        /// </summary>
        /// <param name="arrangeBounds">The bounds to draw in.</param>
        /// <param name="canvas">The canvas to draw on.</param>
        /// <param name="centerX">The center along the x axis.</param>
        /// <param name="centerY">The center along the y axis.</param>
        /// <param name="squareLength">The length of the centered square.</param>
        /// <param name="squareHalfLength">The half length of the centered square.</param>
        /// <param name="squareLeft">The left position of the centered square.</param>
        /// <param name="squareRight">The right position of the centered square.</param>
        /// <param name="squareTop">The top position of the centered square.</param>
        /// <param name="squareBottom">The bottom position of the centered square.</param>
        protected override void DrawIcon(
            Size arrangeBounds,
            Canvas canvas,
            int centerX,
            int centerY,
            int squareLength,
            int squareHalfLength,
            int squareLeft,
            int squareRight,
            int squareTop,
            int squareBottom)
        {
            int shapePadding = 9;

            Line line = new Line();
            line.X1 = squareLeft + shapePadding;
            line.Y1 = squareTop + shapePadding;
            line.X2 = squareRight - shapePadding;
            line.Y2 = squareBottom - shapePadding;
            line.Stroke = Foreground;
            line.StrokeThickness = 2;
            line.StrokeEndLineCap = PenLineCap.Flat;
            canvas.Children.Add(line);

            line = new Line();
            line.X1 = squareRight - shapePadding;
            line.Y1 = squareTop + shapePadding;
            line.X2 = squareLeft + shapePadding;
            line.Y2 = squareBottom - shapePadding;
            line.Stroke = Foreground;
            line.StrokeThickness = 2;
            line.StrokeEndLineCap = PenLineCap.Flat;
            canvas.Children.Add(line);
        }
开发者ID:natewallace,项目名称:Wallace.IDE,代码行数:47,代码来源:WindowCloseButton.cs

示例6: Draw

        public void Draw(Point point)
        {
            var current = point;

            var line = new Line() { X1 = _startPoint.X, Y1 = _startPoint.Y, X2 = current.X, Y2 = current.Y };
            line.Stroke = new SolidColorBrush(this.SelectedColor);
            this._canvas.Children.Add(line);
            _startPoint = current;
        }
开发者ID:zayar,项目名称:Helios,代码行数:9,代码来源:FreeHandTool.cs

示例7: FromPoints

 public Line FromPoints(Point p1, Point p2)
 {
     var line = new Line { X1 = p1.X, Y1 = p1.Y, X2 = p2.X, Y2 = p2.Y, Stroke = Brushes.Wheat, StrokeThickness = 3, SnapsToDevicePixels = true };
     line.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
     Canvas.SetTop(line, p1.Y);
     Canvas.SetLeft(line, p1.X);
     Canvas.SetBottom(line, p2.Y);
     Canvas.SetRight(line, p2.X);
     return line;
 }
开发者ID:tefry,项目名称:ECE1160Project,代码行数:10,代码来源:LineFactory.cs

示例8: Faces

 public static Line Faces(this HexMapItem item, int index)
 {
     var line = new Line
         {
             X1 = item.Faces[index].Item1.Item1,
             Y1 = -1 * item.Faces[index].Item1.Item2,
             X2 = item.Faces[index].Item2.Item1,
             Y2 = -1 * item.Faces[index].Item2.Item2
         };
     return line;
 }
开发者ID:JamesTStanley,项目名称:Hex,代码行数:11,代码来源:HexCoreWpfExtensions.cs

示例9: DrawLine

        private void DrawLine(Point p1, Point p2)
        {
            System.Windows.Shapes.Line line = new System.Windows.Shapes.Line();

            line.X1 = p1.X;
            line.X2 = p2.X;
            line.Y1 = p1.Y;
            line.Y2 = p2.Y;
            line.Stroke = new SolidColorBrush(Colors.Red);

            LayoutRoot.Children.Add(line);
        }
开发者ID:tuliosouza,项目名称:ASG,代码行数:12,代码来源:MainPage.xaml.cs

示例10: InitializeComponent

 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/FBReader.App;component/Views/Controls/MarginGridControl.xaml", System.UriKind.Relative));
     this.self = ((System.Windows.Controls.UserControl)(this.FindName("self")));
     this.LeftLine = ((System.Windows.Shapes.Line)(this.FindName("LeftLine")));
     this.RightLine = ((System.Windows.Shapes.Line)(this.FindName("RightLine")));
     this.TopLine = ((System.Windows.Shapes.Line)(this.FindName("TopLine")));
     this.BottomLine = ((System.Windows.Shapes.Line)(this.FindName("BottomLine")));
 }
开发者ID:bdvsoft,项目名称:reader_wp8_bazed_on_Fbreader,代码行数:12,代码来源:MarginGridControl.g.cs

示例11: GanttDependenciesPresenter

        public GanttDependenciesPresenter()
        {
            this.UseLayoutRounding = false;
            this.Loaded += GanttDependenciesPresenter_Loaded;

            DependencyLinker = new Line();
            DependencyLinker.Stroke = new SolidColorBrush(Colors.Black);
            DependencyLinker.StrokeDashOffset = 3;
            DependencyLinker.StrokeThickness = 1;
            DependencyLinker.IsHitTestVisible = false;
            DependencyLinker.Visibility = System.Windows.Visibility.Collapsed;
        }
开发者ID:eolandezhang,项目名称:Diagram,代码行数:12,代码来源:GanttDependenciesPresenter.cs

示例12: _chart_OnDrawLine

        void _chart_OnDrawLine(object sender, Chart.DrawEventArgs<Events.DoubleDrawingData> e)
        {
            WPShapes.Line line = new WPShapes.Line();
            line.Stroke = new SolidColorBrush(_colors[e.Data.SeriesNo]);
            line.StrokeThickness = 2;

            line.X1 = e.Data.XFrom;
            line.Y1 = e.Data.YFrom;
            line.X2 = e.Data.XTo;
            line.Y2 = e.Data.YTo;

            this.Children.Add(line);
        }
开发者ID:rvenky77,项目名称:Xamarin-Forms-Labs,代码行数:13,代码来源:ChartSurface.cs

示例13: _chart_OnDrawGridLine

        void _chart_OnDrawGridLine(object sender, Chart.DrawEventArgs<Events.DoubleDrawingData> e)
        {
            WPShapes.Line line = new WPShapes.Line();
            line.Stroke = _brush;
            line.StrokeThickness = 2;

            line.X1 = e.Data.XFrom;
            line.Y1 = e.Data.YFrom;
            line.X2 = e.Data.XTo;
            line.Y2 = e.Data.YTo;

            this.Children.Add(line);
        }
开发者ID:rvenky77,项目名称:Xamarin-Forms-Labs,代码行数:13,代码来源:ChartSurface.cs

示例14: initLine

        void initLine(Color c)
        {
            line = new Line();
            line.Stroke = new SolidColorBrush(c);
            line.StrokeThickness = ShapeUtils.LINE_WIDTH;
            line.Effect = ShapeUtils.ShadowProvider();
            line.Tag = this;
           
            selMarker1 = ShapeUtils.MakeMarker();
            selMarker1.Tag = this;

            selMarker2 = ShapeUtils.MakeMarker();
            selMarker2.Tag = this;
        }
开发者ID:gdlprj,项目名称:duscusys,代码行数:14,代码来源:VdSegment.cs

示例15: Dibujar

 public override void Dibujar(MainWindow ventana)
 {
     var ln = new Line
         {
             X1 = CoordX,
             Y1 = CoordY,
             X2 = CoordX2,
             Y2 = CoordY2,
             Stroke = Brushes.Black,
             FlowDirection = System.Windows.FlowDirection.RightToLeft,
             StrokeThickness = 5
         };
     ventana.Dibujador.Children.Add(ln);
 }
开发者ID:hprez21,项目名称:Introduccion-a-los-patrones-de-disenio,代码行数:14,代码来源:Linea.cs


注:本文中的System.Windows.Shapes.Line类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。