次の方法で共有


DataRepeater.ScrollItemIntoView メソッド (Int32)

指定されたスクロールDataRepeaterItem表示モードに、DataRepeaterコントロールです。

名前空間:  Microsoft.VisualBasic.PowerPacks
アセンブリ:  Microsoft.VisualBasic.PowerPacks.Vs (Microsoft.VisualBasic.PowerPacks.Vs.dll 内)

構文

'宣言
Public Sub ScrollItemIntoView ( _
    index As Integer _
)
public void ScrollItemIntoView(
    int index
)
public:
void ScrollItemIntoView(
    int index
)
member ScrollItemIntoView : 
        index:int -> unit
public function ScrollItemIntoView(
    index : int
)

パラメーター

例外

例外 条件
ArgumentOutOfRangeException

指定された値indexは 0 より小さいかより大きいItemCount- 1 です。

解説

呼び出す、ScrollItemIntoViewメソッド、特定の表示をDataRepeaterItemコントロールの表示の一部にします。 項目は選択されません。 項目を選択する次のように設定します。、CurrentItemIndexプロパティです。

アイテムが最小スクロール アルゴリズム。 でビューにスクロールされます。必ずしもアライメントされません、コントロールの上部にします。 コントロールの上部を持つ項目に合わせて、オーバー ロードされた呼び出しScrollItemIntoViewメソッドをalignWithTopパラメーターを設定するtrueです。

次のコード例には、現在選択されている項目に表示されている最初の項目を作成する方法を示しています、DataRepeaterコントロールです。 含む形式であることを前提としています、DataRepeaterという名前のコントロールDataRepeater1とButtonという名前のコントロールSynchButtonです。

Private Sub SynchButton_Click() Handles SynchButton.Click
    ' If the first displayed item is not the current item. 
    If DataRepeater1.FirstDisplayedItemIndex <> 
      DataRepeater1.CurrentItemIndex Then 
        ' Make it the current item.
        DataRepeater1.CurrentItemIndex = 
          DataRepeater1.FirstDisplayedItemIndex
        ' Align it with the top of the control.
        DataRepeater1.ScrollItemIntoView( 
          DataRepeater1.FirstDisplayedItemIndex, True)
    End If 
End Sub
private void synchButton_Click(System.Object sender, System.EventArgs e)
{
    // If the first displayed item is not the current item. 
    if (dataRepeater1.FirstDisplayedItemIndex != dataRepeater1.CurrentItemIndex)
    // Make it the current item.
    {
        dataRepeater1.CurrentItemIndex = dataRepeater1.FirstDisplayedItemIndex;
        // Align it with the top of the control.
        dataRepeater1.ScrollItemIntoView(dataRepeater1.FirstDisplayedItemIndex, true);
    }
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

DataRepeater クラス

ScrollItemIntoView オーバーロード

Microsoft.VisualBasic.PowerPacks 名前空間

CurrentItemIndex

FirstDisplayedItemIndex

その他の技術情報

DataRepeater コントロールの概要 (Visual Studio)

方法 : DataRepeater コントロールでデータを検索する (Visual Studio)