Bewerken

Share via


StylusPointCollection Constructors

Definition

Initializes a new instance of the StylusPointCollection class.

Overloads

StylusPointCollection()

Initializes a new instance of the StylusPointCollection class.

StylusPointCollection(IEnumerable<StylusPoint>)

Initializes a new instance of the StylusPointCollection class with the specified StylusPoint objects.

StylusPointCollection(IEnumerable<Point>)

Initializes a new instance of the StylusPointCollection class with specified points.

StylusPointCollection(Int32)

Initializes a new instance of the StylusPointCollection class that may initially contain the specified number of StylusPoint objects.

StylusPointCollection(StylusPointDescription)

Initializes a new instance of the StylusPointCollection class that contains the properties specified in the StylusPointDescription.

StylusPointCollection(StylusPointDescription, Int32)

Initializes a new instance of the StylusPointCollection class that is the specified size and contains the properties specified in the StylusPointDescription.

StylusPointCollection()

Initializes a new instance of the StylusPointCollection class.

public:
 StylusPointCollection();
public StylusPointCollection ();
Public Sub New ()

Examples

The following example collects StylusPoint objects in the OnStylusDown method of a custom control. The example creates a StylusPointCollection by specifying the StylusPointDescription and the initial size of the StylusPointCollection.

StylusPointCollection stylusPoints;

protected override void OnStylusDown(StylusDownEventArgs e)
{
    base.OnStylusDown(e);

    StylusPointCollection eventPoints = e.GetStylusPoints(this);

    // Create a new StylusPointCollection using the StylusPointDescription
    // from the stylus points in the StylusDownEventArgs.
    stylusPoints = new StylusPointCollection(eventPoints.Description, eventPoints.Count);
    stylusPoints.Add(eventPoints);
}
Private stylusPoints As StylusPointCollection


Protected Overrides Sub OnStylusDown(ByVal e As StylusDownEventArgs) 
    MyBase.OnStylusDown(e)
    
    Dim eventPoints As StylusPointCollection = e.GetStylusPoints(Me)
    
    ' Create a new StylusPointCollection using the StylusPointDescription
    ' from the stylus points in the StylusDownEventArgs.
    stylusPoints = New StylusPointCollection(eventPoints.Description, eventPoints.Count)
    stylusPoints.Add(eventPoints)

End Sub

Applies to

StylusPointCollection(IEnumerable<StylusPoint>)

Initializes a new instance of the StylusPointCollection class with the specified StylusPoint objects.

public:
 StylusPointCollection(System::Collections::Generic::IEnumerable<System::Windows::Input::StylusPoint> ^ stylusPoints);
public StylusPointCollection (System.Collections.Generic.IEnumerable<System.Windows.Input.StylusPoint> stylusPoints);
new System.Windows.Input.StylusPointCollection : seq<System.Windows.Input.StylusPoint> -> System.Windows.Input.StylusPointCollection
Public Sub New (stylusPoints As IEnumerable(Of StylusPoint))

Parameters

stylusPoints
IEnumerable<StylusPoint>

A generic IEnumerable of type StylusPoint to add to the StylusPointCollection.

Exceptions

stylusPoints is null.

The length of points is 0.

-or-

The StylusPoint objects in stylusPoints have incompatible StylusPointDescription objects.

Examples

The following example creates a StylusPointCollection.

StylusPoint stylusPoint1 =  new StylusPoint(100, 100, .5f);
StylusPoint stylusPoint2 = new StylusPoint(200, 200, .35f);

StylusPointCollection points = new StylusPointCollection(
    new StylusPoint[] { stylusPoint1, stylusPoint2 });
Dim stylusPoint1 As New StylusPoint(100, 100, 0.5F)
Dim stylusPoint2 As New StylusPoint(200, 200, 0.35F)

Dim points As New StylusPointCollection(New StylusPoint() {stylusPoint1, stylusPoint2})

Applies to

StylusPointCollection(IEnumerable<Point>)

Initializes a new instance of the StylusPointCollection class with specified points.

public:
 StylusPointCollection(System::Collections::Generic::IEnumerable<System::Windows::Point> ^ points);
public StylusPointCollection (System.Collections.Generic.IEnumerable<System.Windows.Point> points);
new System.Windows.Input.StylusPointCollection : seq<System.Windows.Point> -> System.Windows.Input.StylusPointCollection
Public Sub New (points As IEnumerable(Of Point))

Parameters

points
IEnumerable<Point>

A generic IEnumerable of type Point that specifies the StylusPoint objects to add to the StylusPointCollection.

Exceptions

points is null.

The length of points is 0.

Examples

The following example creates a StylusPointCollection.

StylusPointCollection points = new StylusPointCollection(new Point[]
    {
        new Point(100, 100),
        new Point(100, 200),
        new Point(200, 250),
        new Point(300, 300)
    });
Dim points As New StylusPointCollection(New Point() _
                        {New Point(100, 100), _
                         New Point(100, 200), _
                         New Point(200, 250), _
                         New Point(300, 300)})

Applies to

StylusPointCollection(Int32)

Initializes a new instance of the StylusPointCollection class that may initially contain the specified number of StylusPoint objects.

public:
 StylusPointCollection(int initialCapacity);
public StylusPointCollection (int initialCapacity);
new System.Windows.Input.StylusPointCollection : int -> System.Windows.Input.StylusPointCollection
Public Sub New (initialCapacity As Integer)

Parameters

initialCapacity
Int32

The number of StylusPoint objects the StylusPointCollection can initially contain.

Exceptions

initialCapacity is negative.

Examples

The following example collects StylusPoint objects in the OnStylusDown method of a custom control. The example creates a StylusPointCollection by specifying both the StylusPointDescription and the initial size of the StylusPointCollection.

StylusPointCollection stylusPoints;

protected override void OnStylusDown(StylusDownEventArgs e)
{
    base.OnStylusDown(e);

    StylusPointCollection eventPoints = e.GetStylusPoints(this);

    // Create a new StylusPointCollection using the StylusPointDescription
    // from the stylus points in the StylusDownEventArgs.
    stylusPoints = new StylusPointCollection(eventPoints.Description, eventPoints.Count);
    stylusPoints.Add(eventPoints);
}
Private stylusPoints As StylusPointCollection


Protected Overrides Sub OnStylusDown(ByVal e As StylusDownEventArgs) 
    MyBase.OnStylusDown(e)
    
    Dim eventPoints As StylusPointCollection = e.GetStylusPoints(Me)
    
    ' Create a new StylusPointCollection using the StylusPointDescription
    ' from the stylus points in the StylusDownEventArgs.
    stylusPoints = New StylusPointCollection(eventPoints.Description, eventPoints.Count)
    stylusPoints.Add(eventPoints)

End Sub

Remarks

When you use the StylusPointCollection constructor to create a new StylusPointCollection, you specify it's initialCapacity. However, you can add more StylusPoint objects by calling the Add method.

Applies to

StylusPointCollection(StylusPointDescription)

Initializes a new instance of the StylusPointCollection class that contains the properties specified in the StylusPointDescription.

public:
 StylusPointCollection(System::Windows::Input::StylusPointDescription ^ stylusPointDescription);
public StylusPointCollection (System.Windows.Input.StylusPointDescription stylusPointDescription);
new System.Windows.Input.StylusPointCollection : System.Windows.Input.StylusPointDescription -> System.Windows.Input.StylusPointCollection
Public Sub New (stylusPointDescription As StylusPointDescription)

Parameters

stylusPointDescription
StylusPointDescription

A StylusPointDescription that specifies the additional properties stored in each StylusPoint.

Exceptions

stylusPointDescription is null.

Examples

The following example collects StylusPoint objects in the OnStylusDown method of a custom control. The example creates a StylusPointCollection by specifying the StylusPointDescription and the initial size of the StylusPointCollection.

StylusPointCollection stylusPoints;

protected override void OnStylusDown(StylusDownEventArgs e)
{
    base.OnStylusDown(e);

    StylusPointCollection eventPoints = e.GetStylusPoints(this);

    // Create a new StylusPointCollection using the StylusPointDescription
    // from the stylus points in the StylusDownEventArgs.
    stylusPoints = new StylusPointCollection(eventPoints.Description, eventPoints.Count);
    stylusPoints.Add(eventPoints);
}
Private stylusPoints As StylusPointCollection


Protected Overrides Sub OnStylusDown(ByVal e As StylusDownEventArgs) 
    MyBase.OnStylusDown(e)
    
    Dim eventPoints As StylusPointCollection = e.GetStylusPoints(Me)
    
    ' Create a new StylusPointCollection using the StylusPointDescription
    ' from the stylus points in the StylusDownEventArgs.
    stylusPoints = New StylusPointCollection(eventPoints.Description, eventPoints.Count)
    stylusPoints.Add(eventPoints)

End Sub

Remarks

All StylusPoint objects added to the StylusPointCollection must have a StylusPointDescription that is compatible with stylusPointDescription.

Applies to

StylusPointCollection(StylusPointDescription, Int32)

Initializes a new instance of the StylusPointCollection class that is the specified size and contains the properties specified in the StylusPointDescription.

public:
 StylusPointCollection(System::Windows::Input::StylusPointDescription ^ stylusPointDescription, int initialCapacity);
public StylusPointCollection (System.Windows.Input.StylusPointDescription stylusPointDescription, int initialCapacity);
new System.Windows.Input.StylusPointCollection : System.Windows.Input.StylusPointDescription * int -> System.Windows.Input.StylusPointCollection
Public Sub New (stylusPointDescription As StylusPointDescription, initialCapacity As Integer)

Parameters

stylusPointDescription
StylusPointDescription

A StylusPointDescription that specifies the additional properties stored in each StylusPoint.

initialCapacity
Int32

The number of StylusPoint objects the StylusPointCollection can initially contain.

Exceptions

initialCapacity is negative.

stylusPointDescription is null.

Examples

The following example collects StylusPoint objects in the OnStylusDown method of a custom control. The example creates a StylusPointCollection by specifying the StylusPointDescription and the initial size of the StylusPointCollection.

StylusPointCollection stylusPoints;

protected override void OnStylusDown(StylusDownEventArgs e)
{
    base.OnStylusDown(e);

    StylusPointCollection eventPoints = e.GetStylusPoints(this);

    // Create a new StylusPointCollection using the StylusPointDescription
    // from the stylus points in the StylusDownEventArgs.
    stylusPoints = new StylusPointCollection(eventPoints.Description, eventPoints.Count);
    stylusPoints.Add(eventPoints);
}
Private stylusPoints As StylusPointCollection


Protected Overrides Sub OnStylusDown(ByVal e As StylusDownEventArgs) 
    MyBase.OnStylusDown(e)
    
    Dim eventPoints As StylusPointCollection = e.GetStylusPoints(Me)
    
    ' Create a new StylusPointCollection using the StylusPointDescription
    ' from the stylus points in the StylusDownEventArgs.
    stylusPoints = New StylusPointCollection(eventPoints.Description, eventPoints.Count)
    stylusPoints.Add(eventPoints)

End Sub

Remarks

When you use the StylusPointCollection constructor to create a new StylusPointCollection, the StylusPointCollection is created with the capacity to hold the specified number of StylusPoint objects. You can add more StylusPoint objects than initialCapacity by calling the Add method.

Applies to