码迷,mamicode.com
首页 > Windows程序 > 详细

C#的OpenFileDialog和SaveFileDialog的常见用法(转)

时间:2014-12-04 19:32:56      阅读:483      评论:0      收藏:0      [点我收藏+]

标签:sp   文件   log   bs   ef   as   new   nbsp   br   

OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.InitialDirectory = strOpenFileFolder;//初始目录,不赋值也可以
openFileDialog1.Filter = “mxml文件(*.mxml)|*.mxml”;//文件类型
openFileDialog1.ShowDialog();//弹出选择框
String strOpenFileFolder = openFileDialog1.FileName.Substring(0,openFileDialog1.FileName.LastIndexOf(‘\\’));//打开的文件的目录
String strOpenFileName = openFileDialog1.FileName;//打开的文件的全限定名

SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            saveFileDialog1.InitialDirectory = strSaveFileName;//保存的默认目录,不赋值也可以
saveFileDialog1.Filter = “swf文件(*.swf)|*.swf”;//过滤显示的文件类型
saveFileDialog1.FileName = strOpenFileName.Substring(0,strOpenFileName.LastIndexOf(‘.’))+”.swf”;//保存的文件名
saveFileDialog1.ShowDialog();//弹出选择框
String strSaveFileFolder = saveFileDialog1.FileName.Substring(0,saveFileDialog1.FileName.LastIndexOf(‘\\’));//保存的文件的目录
String strSaveFileName = saveFileDialog1.FileName;//保存的文件的全限定名

C#的OpenFileDialog和SaveFileDialog的常见用法(转)

标签:sp   文件   log   bs   ef   as   new   nbsp   br   

原文地址:http://www.cnblogs.com/renshengbuduanxuexi/p/4143398.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!