如何让listbox旁的滚动条在当前显示满的时侯自动向下滚动?
千分 2010-09-12 11:36:40 刚接触ASP.NET 想做一个关于listbox增添删改的程序
目前的代码是这样的
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ListBoxMode
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void buttonAdd_Click(object sender, EventArgs e)
{
listBox2.Items .Add(listBox1.SelectedItem); //将选中listbox1中的选中的项向listbox2里面添加项
}
private void buttonDelete_Click(object sender, EventArgs e)
{
listBox2.Items.Remove(listBox2.SelectedItem); //删除lisbox2里面的选中飞项
}
//下面是我想写的使滚动条滚动的代码,可是一滚就滚动到最后面去了,还来不及选择
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
listBox1.SelectedItem = listBox1.Items[listBox1.SelectedIndex + 1]; /
}
}
}
希望各种高手们帮忙解决一下