private void Form1_Load(object sender, EventArgs e)
{
this.listView2.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; //不显示列的标头
this.listView2.MinimumSize = new Size(150, 200); //给定最小宽度为150,给列的宽度为100(要小于listview的宽度,否则会出现水平滚动条)
listView2.FullRowSelect = true; //可选中整行
string[] directory = Directory.GetDirectories("F:\\windows"); //将windows文件夹下的所有文件夹显示出来(像qq列表一样)
foreach (string s in directory)
{
this.listView2.Items.Add(s.Substring(s.LastIndexOf('\\') + 1), 0);
}
this.listView2.Scrollable = true; //显示滚动条
this.listView2.SmallImageList = this.imageList1;
this.listView2.View = View.SmallIcon;
}