标签:文件 default .com name pat initial setting pen alt
OpenFileDialog file1 = new OpenFileDialog();
if (Properties.Settings.Default.path1!= "" && Properties.Settings.Default.path1 != null)
{
file1.InitialDirectory = Properties.Settings.Default.path1; //设置打开文件的路径
}
file1.ShowDialog();//打开文件夹
if (file1.FileName!="" && file1.FileName != null)
{
m_FilePath = file1.FileName; //获取文件路径
string PathWJJ = (file1.FileName).Substring(0, (file1.FileName).Length-(((file1.FileName).Length - (file1.FileName).LastIndexOf(‘\\‘))));//获取文件夹路径
Properties.Settings.Default.path1 = PathWJJ;//保存文件夹路径
Properties.Settings.Default.Save();
m_FileName = (file1.FileName).Substring((file1.FileName).LastIndexOf(‘\\‘) + 1, (file1.FileName).LastIndexOf(‘.‘) - (file1.FileName).LastIndexOf(‘\\‘) - 1);//获取文件名,无后缀
this.textBox1.Text = m_FilePath;
}
标签:文件 default .com name pat initial setting pen alt
原文地址:http://www.cnblogs.com/zhushuangmei/p/7506594.html