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