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);

posted on 2013-01-07 09:40  onedime  阅读(610)  评论(0编辑  收藏  举报