C# ListBox 垂直滚动条自动下滚方法
方法一:
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);