當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。