gpt4 book ai didi

c# - 有没有办法在 C# WinForms 中自动滚动列表框

转载 作者:太空宇宙 更新时间:2023-11-03 19:05:37 24 4
gpt4 key购买 nike

我编写的程序将在大显示器上的几个列表框中显示数字列表,我的问题是有没有办法自动滚动列表框以显示框中的所有数据?

最佳答案

通常,我会这样做:

listBox.SelectedIndex = listBox.Items.Count - 1;
listBox.SelectedIndex = -1;

不过你也可以试试

int nItems = (int)(listBox.Height / listBox.ItemHeight);
listBox.TopIndex = listBox.Items.Count - nItems;

希望这有帮助:)

关于c# - 有没有办法在 C# WinForms 中自动滚动列表框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28285130/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com