c#.et 窗体应用程序,打开指定文件夹,选中文件的方法

        private void btnOpenFile_Click(object sender, EventArgs e)
        {
            string _FilePath = this.txtFileFullPath.Text.Trim();
            if (File.Exists(_FilePath))
            {
                //打开指定文件
                System.Diagnostics.Process.Start(_FilePath);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string _FilePath = this.txtFileFullPath.Text.Trim();

            //打开指定文件夹选中文件(路径不存在则默认打开并选中我的文档)
            System.Diagnostics.Process.Start("explorer.exe", "/select," + _FilePath);

        }

 

posted @ 2013-10-25 11:54  zhangsir  阅读(501)  评论(0编辑  收藏  举报