Eva*_*ark 2 c# listboxitems winforms
我编写一个程序将在大显示器上的多个列表框中显示一个数字列表,我的问题是有没有办法自动滚动列表框以显示框中的所有数据?
通常,我会这样做:
listBox.SelectedIndex = listBox.Items.Count - 1;
listBox.SelectedIndex = -1;
Run Code Online (Sandbox Code Playgroud)
但你也可以试试
int nItems = (int)(listBox.Height / listBox.ItemHeight);
listBox.TopIndex = listBox.Items.Count - nItems;
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助 :)