获取系统特殊文件夹路径

实现效果:

  

知识运用:

  Environment类的GetFolderPath方法    //获取指向由枚举标识的系统特殊文件夹的路径

  public static string GetFolderPath (Environment.SpecialFolder   folder)

  

实现代码:

        private void Form1_Load(object sender, EventArgs e)
        {
            foreach (Environment.SpecialFolder item in System.Enum.GetValues(typeof(Environment.SpecialFolder)))
            {
                ListViewItem it = new ListViewItem(item.ToString());
                it.SubItems.Add(Environment.GetFolderPath(item));
                listView1.Items.Add(it);
            }
        }

猜你喜欢

转载自www.cnblogs.com/feiyucha/p/10298038.html
今日推荐