次の方法で共有


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 オブジェクト内の最初のポイントの 0 から始まるインデックス。
  • points
    型 : array<System.Drawing.Point[]
    インデックスから開始される Stroke オブジェクト内のポイントを置き換える、新しい Point 値の配列。
    index.

戻り値

型 : 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