Stroke.SetPoints 方法 (Int32, array<Point[])

设置 Stroke 对象中从指定索引处开始的一系列 Point 结构。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public Function SetPoints ( _
    index As Integer, _
    points As Point() _
) As Integer
用法
Dim instance As Stroke
Dim index As Integer
Dim points As Point()
Dim returnValue As Integer

returnValue = instance.SetPoints(index, _
    points)
public int SetPoints(
    int index,
    Point[] points
)
public:
int SetPoints(
    int index, 
    array<Point>^ points
)
public int SetPoints(
    int index,
    Point[] points
)
public function SetPoints(
    index : int, 
    points : Point[]
) : int

参数

  • index
    类型:System.Int32
    Stroke 对象中要修改的第一个点的从零开始的索引。

返回值

类型:System.Int32
返回点集的实际数目。

备注

此方法不更改 Stroke 对象中点的数目。若要更改 Stroke 对象中点的数目,必须创建一个新的 Stroke 对象或者拆分 Stroke 对象。

点数组的长度确定 Stroke 对象中要修改的点的数目。

此方法不用于截断 Stroke 对象。如果点数组所包含的点比 Stroke 对象少,则不修改 Stroke 对象中的其余点。

此方法不用于扩展 Stroke 对象。如果点数组所包含的点比 Stroke 对象多,则不使用多余点。

示例

在此示例中,将 InkOverlay 的所有选定 Stroke 对象的后半部分更改为水平笔画,方法是:获取该 Stroke 的后半部分的点,然后将每个 Y 坐标标准化。修改这些值后,使用 SetPoints 方法更新该 Stroke 对象。

For Each S As Stroke In mInkOverlay.Selection
    Dim halfwayPt As Integer = S.PacketCount / 2
    ' get the points
    Dim pts() As Point = S.GetPoints(halfwayPt, S.PacketCount - halfwayPt)
    ' set each Y coordinate to the first Y coordinate
    For k As Integer = 0 To pts.Length - 1
        pts(k).Y = pts(0).Y
    Next
    ' update the points
    S.SetPoints(halfwayPt, pts)
Next
foreach (Stroke S in mInkOverlay.Selection)
{
    int halfwayPt = S.PacketCount / 2;
    // get the points
    Point[] pts = S.GetPoints(halfwayPt, S.PacketCount - halfwayPt);
    // set each Y coordinate to the first Y coordinate
    for (int k = 0; k < pts.Length; k++)
    {
        pts[k].Y = pts[0].Y;
    }
    // update the points
    S.SetPoints(halfwayPt, pts);
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

Stroke 类

Stroke 成员

SetPoints 重载

Microsoft.Ink 命名空间

SetPoints

Stroke.SetPoint