次の方法で共有


ITextRangeProvider.MoveEndpointByUnit メソッド

定義

テキスト範囲の 1 つのエンドポイントを、指定されたテキスト単位数の分、ドキュメントの範囲内で移動します。

public:
 int MoveEndpointByUnit(System::Windows::Automation::Text::TextPatternRangeEndpoint endpoint, System::Windows::Automation::Text::TextUnit unit, int count);
public int MoveEndpointByUnit (System.Windows.Automation.Text.TextPatternRangeEndpoint endpoint, System.Windows.Automation.Text.TextUnit unit, int count);
abstract member MoveEndpointByUnit : System.Windows.Automation.Text.TextPatternRangeEndpoint * System.Windows.Automation.Text.TextUnit * int -> int
Public Function MoveEndpointByUnit (endpoint As TextPatternRangeEndpoint, unit As TextUnit, count As Integer) As Integer

パラメーター

endpoint
TextPatternRangeEndpoint

移動するエンドポイント。

unit
TextUnit

移動するためのテキスト単位。

count
Int32

移動する単位の数。 正の値はエンドポイントを前方に移動します。 負の値は後方に移動します。 0 の場合は移動されません。

戻り値

実際に移動した単位の数。エンドポイントの移動によりドキュメントの先頭または末尾に達した場合は、要求した数よりも小さくなる場合があります。

注釈

テキスト範囲の内容を走査する必要がある場合、 Move メソッドを正常に実行するために、一連の手順がその背後で関係しています。

  1. テキスト範囲は正規化されます。つまり、テキスト範囲は Start エンドポイントで低次元テキスト範囲に縮小されるため、 End エンドポイントは不要になります。 この手順は、テキスト範囲が境界をまた unit ぐ状況であいまいさを取り除くために必要です。たとえば、"{The U}RL https://www.microsoft.com/ is embedded in text" ("{" と "}" がテキスト範囲のエンドポイント) です。

  2. 結果として得られる範囲は、 DocumentRange 内で、要求された unit 境界の先頭に向かって後方に移動されます。

  3. その後、この範囲は、要求された 1 つの End 境界の分、 unit エンドポイントを移動することによって、低次元テキスト範囲の状態から展開されます。

Move & ExpandToEnclosingUnit Range
テキスト範囲を Move() と ExpandToEnclosingUnit() に対して調整する方法の例

MoveEndpointByUnitは、指定TextUnitされた がコントロールでサポートされていない場合は、次にサポートされる最大TextUnitに延期されます。

最小単位から最大値までの順序を以下に示します。

適用対象