C# ListBox 垂直滚动条自动下滚方法

发布时间 2023-04-05 20:25:13作者: 【君莫笑】
方法一:

 this.listBox1.SelectedIndex =  this.listBox1.Items.Count - 1;

方法二:

this.listBox1.TopIndex = this.listBox1.Items.Count - (int)(this.listBox1.Height / this.listBox1.ItemHeight);

方法三:
using System.Runtime.InteropServices;
[DllImport("User32.dll")]
private static extern Int32 SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
public const int WM_VSCROLL = 0x0115;
public const int SB_BOTTOM = 7;
SendMessage(listBox1.Handle, WM_VSCROLL, SB_BOTTOM, 0);
来源: https://www.cnblogs.com/onedime/archive/2013/01/07/2848635.html