CListBox::GetTopIndex

更新 : 2007 年 11 月

リスト ボックスの先頭に表示されている項目を 0 から始まるインデックスで取得します。

int GetTopIndex( ) const;

戻り値

正常終了した場合は、リスト ボックスの先頭に表示されている項目を 0 から始まるインデックスで返します。それ以外の場合は LB_ERR を返します。

解説

初期状態では、項目 0 がリスト ボックスの先頭にありますが、リスト ボックスをスクロールした場合は、別の項目が先頭に表示されることもあります。

使用例

// Want an item in the bottom half to be the first visible item.
int n = m_myListBox.GetCount()/2;
if (m_myListBox.GetTopIndex() < n)
{
   m_myListBox.SetTopIndex(n);
   ASSERT(m_myListBox.GetTopIndex() == n);
}

必要条件

ヘッダー : afxwin.h

参照

参照

CListBox クラス

階層図

CListBox::SetTopIndex

LB_GETTOPINDEX

その他の技術情報

CListBox のメンバ