StylusPointCollection Constructor (Int32)
Initializes a new instance of the StylusPointCollection class that may initially contain the specified number of StylusPoint objects.
Assembly: PresentationCore (in PresentationCore.dll)
You cannot use constructors in XAML.
Parameters
- initialCapacity
- Type: System.Int32
The number of StylusPoint objects the StylusPointCollection can initially contain.
| Exception | Condition |
|---|---|
| ArgumentException | initialCapacity is negative. |
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.
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); }
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.