C# SaveFileDialog的用法
2015-07-17 12:40
519 查看
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;//保存的文件的全限定名
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#选择文件夹、打开文件夹、选择文件
- C#让应用程序只运行一个实例的几种方法
- C#的DLLspy超犀利后门
- C# in depth ( 第二章 C#1.0所搭建的核心基础)
- c#中如何获取本机MAC地址、IP地址、硬盘ID、CPU序列号等系统信息
- 使用RAPI库操作移动手持设备WINCE——C#语言描述
- C#读取信息备份
- C#基于Socket的简单聊天室实践
- [C#] 谈谈异步编程async await
- IList, ICollection ,IEnumerable AND IEnumerator in C#
- Vs2010在C#类文件头部添加文件注释的方法
- C#里面MessageBox不能乱用,阻塞和非阻塞,模态对话框和非模态
- C#基础总结 .
- 读改善c#代码157个建议:建议10~12
- C#播放声音的四种方法 +AxWindowsMediaPlayer的详细用法
- C# WinForm实现粘贴图片到PictureBox及复制PictureBox中的图片
- C# 导出Excel数据
- c#4.0捷径教程委托、匿名方法和事件笔记
- C#中ArrayList和HashTable
- C#调用存储过程