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 Move() と ExpandToEnclosingUnit() に対してテキスト範囲を調整する方法の例

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

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

適用対象