• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Shapes.Line类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: InitializeComponent

 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/5-Ruler;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.RulerCanvas = ((System.Windows.Controls.Canvas)(this.FindName("RulerCanvas")));
     this.ExactMeasurementLine = ((System.Windows.Shapes.Line)(this.FindName("ExactMeasurementLine")));
     this.ButtonsCanvas = ((System.Windows.Controls.Canvas)(this.FindName("ButtonsCanvas")));
     this.LeftOrRightBtn = ((System.Windows.Controls.Button)(this.FindName("LeftOrRightBtn")));
     this.LeftBtn = ((System.Windows.Controls.Primitives.RepeatButton)(this.FindName("LeftBtn")));
     this.ExactMeasurementTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("ExactMeasurementTextBlock")));
 }
开发者ID:1e0heen9,项目名称:wp7demo101,代码行数:14,代码来源:MainPage.g.cs


示例17: InitializeComponent

 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/311NYC;component/AboutPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.About311 = ((System.Windows.Controls.Grid)(this.FindName("About311")));
     this.textBlock1 = ((System.Windows.Controls.TextBlock)(this.FindName("textBlock1")));
     this.hyperlinkButton1 = ((System.Windows.Controls.HyperlinkButton)(this.FindName("hyperlinkButton1")));
     this.hyperlinkButton2 = ((System.Windows.Controls.HyperlinkButton)(this.FindName("hyperlinkButton2")));
     this.line1 = ((System.Windows.Shapes.Line)(this.FindName("line1")));
     this.line2 = ((System.Windows.Shapes.Line)(this.FindName("line2")));
 }
开发者ID:FaisalNahian,项目名称:311NYC,代码行数:14,代码来源:AboutPage.g.i.cs


示例18: DimensionPainter

        public DimensionPainter(Canvas canvas)
        {
            _canvas = canvas;

            _canvas.Children.Add(_pointerLine = new Line
            {
                X1 = 0,
                Y1 = 0,
                X2 = 0,
                Y2 = height,
                Stroke = new SolidColorBrush(Color.FromArgb(0x77, 0xFF, 0, 0)),
                StrokeThickness = 1
            });
        }
开发者ID:vbodurov,项目名称:space-manager,代码行数:14,代码来源:DimensionPainter.cs


示例19: draw_axis

        void draw_axis(Point start, Point end)
        {
            var line = new Line();

            line.X1 = start.X;
            line.Y1 = start.Y;
            line.X2 = end.X;
            line.Y2 = end.Y;

            line.Stroke = Brushes.Black;
            line.StrokeThickness = 1;
            line.SnapsToDevicePixels = true;
            line.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);

            canvas.Children.Add(line);
        }
开发者ID:jchristian,项目名称:code_katas,代码行数:16,代码来源:GuiGrapher.cs


示例20: Canvas1_TouchDown

        private void Canvas1_TouchDown(object sender, TouchEventArgs e)
        {
            var pt = e.GetTouchPoint(Canvas1);

            // 縦線を作ります。
            var lineV = new Line();
            lineV.X1 = lineV.X2 = pt.Position.X;
            lineV.Y1 = 0;
            lineV.Y2 = ActualHeight;
            lineV.Stroke = Brushes.Red;
            Canvas1.Children.Add(lineV);
            lineVList[e.TouchDevice] = lineV;

            // 横線を作ります。
            var lineH = new Line();
            lineH.X1 = 0;
            lineH.X2 = ActualWidth;
            lineH.Y1 = lineH.Y2 = pt.Position.Y;
            lineH.Stroke = Brushes.Red;
            Canvas1.Children.Add(lineH);
            lineHList[e.TouchDevice] = lineH;

            // 円を作ります。
            var ellipse = new Ellipse();
            ellipse.Width = 50;
            ellipse.Height = 50;
            ellipse.Fill = Brushes.Blue;
            ellipse.RenderTransform
                = new TranslateTransform(pt.Position.X - ellipse.RenderSize.Width / 2,
                                           pt.Position.Y - ellipse.RenderSize.Height / 2);
            Canvas1.Children.Add(ellipse);
            ellipseList[e.TouchDevice] = ellipse;

            // idを表すラベルを作ります。
            var label = new Label();
            label.Foreground = Brushes.White;
            label.FontSize = 36;
            label.Content = e.TouchDevice.Id;
            label.RenderTransform = new TranslateTransform(pt.Position.X - label.RenderSize.Width / 2,
                                           pt.Position.Y - label.RenderSize.Height / 2);
            Canvas1.Children.Add(label);
            labelList[e.TouchDevice] = label;

            Canvas1.InvalidateVisual();

            Canvas1.CaptureTouch(e.TouchDevice);
        }
开发者ID:umhr,项目名称:MultiTouchChecker,代码行数:47,代码来源:MainWindow.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Shapes.Path类代码示例发布时间:2022-05-26
下一篇:
C# Shapes.Ellipse类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap