StreamGeometryContext.PolyLineTo(IList<Point>, Boolean, Boolean) 메서드

정의

하나 이상의 연결된 직선을 그립니다.

public:
 abstract void PolyLineTo(System::Collections::Generic::IList<System::Windows::Point> ^ points, bool isStroked, bool isSmoothJoin);
public abstract void PolyLineTo(System.Collections.Generic.IList<System.Windows.Point> points, bool isStroked, bool isSmoothJoin);
abstract member PolyLineTo : System.Collections.Generic.IList<System.Windows.Point> * bool * bool -> unit
Public MustOverride Sub PolyLineTo (points As IList(Of Point), isStroked As Boolean, isSmoothJoin As Boolean)

매개 변수

points
IList<Point>

하나 이상의 연결된 직선에 대한 대상 지점을 지정하는 점의 컬렉션입니다.

isStroked
Boolean

true 세그먼트를 렌더링하는 데 사용할 때 세그먼트가 Pen 스트로크되도록 하려면 .이고, false그렇지 않으면 .

isSmoothJoin
Boolean

true 를 사용하여 스트로크 Pen할 때 이 세그먼트와 이전 세그먼트 사이의 조인을 모서리로 처리합니다. 그렇지 않으면 false.

예외

메서드를 호출하여 그림을 시작하지 않고 세그먼트를 추가하려고 했습니다 BeginFigure(Point, Boolean, Boolean) .

예제

다음 예제에서는 메서드를 사용하여 삼각형을 그리는 PolyLineTo 방법을 보여줍니다.

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace SDKSample
{
    public partial class StreamGeometryPolyLineToExample : Page
    {
        public StreamGeometryPolyLineToExample()
        {
            // Create a path to draw a geometry with.
            Path myPath = new Path();
            myPath.Stroke = Brushes.Black;
            myPath.StrokeThickness = 1;

            // Create a StreamGeometry to use to specify myPath.
            StreamGeometry geometry = new StreamGeometry();

            // Open a StreamGeometryContext that can be used to describe this StreamGeometry 
            // object's contents. 
            using (StreamGeometryContext ctx = geometry.Open())
            {
                // Begin the triangle at the point specified.
                ctx.BeginFigure(new Point(10, 100), true /* is filled */, true /* is closed */);

                // Create a collection of Point structures that will be used with the PolyLineTo 
                // Method to create a triangle.
                List<Point> pointList = new List<Point>();

                // Two Points are added to the collection. The PolyLineTo method will draw lines
                // between the Points of the collection.
                pointList.Add(new Point(100, 100));
                pointList.Add(new Point(100, 50));

                // Create a triangle using the collection of Point Structures.
                ctx.PolyLineTo(pointList, true /* is stroked */, false /* is smooth join */);
            }

            // Freeze the geometry (make it unmodifiable)
            // for additional performance benefits.
            geometry.Freeze();
            
            // specify the shape (triangle) of the path using the StreamGeometry.
            myPath.Data = geometry;

            // Add path shape to the UI.
            StackPanel mainPanel = new StackPanel();
            mainPanel.Children.Add(myPath);
            this.Content = mainPanel;
        }
    }
}

Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Media
Imports System.Windows.Shapes
Imports System.Collections.Generic

Namespace SDKSample
    Partial Public Class StreamGeometryPolyLineToExample
        Inherits Page
        Public Sub New()
            ' Create a path to draw a geometry with.
            Dim myPath As New Path()
            myPath.Stroke = Brushes.Black
            myPath.StrokeThickness = 1

            ' Create a StreamGeometry to use to specify myPath.
            Dim geometry As New StreamGeometry()

            ' Open a StreamGeometryContext that can be used to describe this StreamGeometry 
            ' object's contents. 
            Using ctx As StreamGeometryContext = geometry.Open()
                ' Begin the triangle at the point specified.
                ctx.BeginFigure(New Point(10, 100), True, True) ' is closed  -  is filled 

                ' Create a collection of Point structures that will be used with the PolyLineTo 
                ' Method to create a triangle.
                Dim pointList As New List(Of Point)()

                ' Two Points are added to the collection. The PolyLineTo method will draw lines
                ' between the Points of the collection.
                pointList.Add(New Point(100, 100))
                pointList.Add(New Point(100, 50))

                ' Create a triangle using the collection of Point Structures.
                ctx.PolyLineTo(pointList, True, False) ' is smooth join  -  is stroked 

            End Using

            ' Freeze the geometry (make it unmodifiable)
            ' for additional performance benefits.
            geometry.Freeze()

            ' specify the shape (triangle) of the path using the StreamGeometry.
            myPath.Data = geometry

            ' Add path shape to the UI.
            Dim mainPanel As New StackPanel()
            mainPanel.Children.Add(myPath)
            Me.Content = mainPanel
        End Sub
    End Class
End Namespace

설명

이 메서드는 이전 세그먼트의 끝점을 시작점으로 사용합니다. 그림의 첫 번째 세그먼트인 경우 메서드에서 지정한 BeginFigure 점을 시작점으로 사용합니다.

스트로크 StreamGeometry 되지 않거나 채워지지 않은 세그먼트가 포함된 Transform 경우 A를 serialize할 수 없습니다.

적용 대상

추가 정보