作者: 菜鸟L
查看: 1478|回复: 1

[求助] 新手求指导

[复制链接]
菜鸟L 发表于 2017-7-13 16:21:14 | 显示全部楼层 |阅读模式
查看: 1478|回复: 1
protected bool Save(SaveType type) {
      // Get the file name
      string newFileName = this.FileName;
      if( (type == SaveType.SaveAs) || (type == SaveType.SaveCopyAs) || string.IsNullOrEmpty(newFileName) ) {
        // Set up the dialog
        this.saveFileDialog.DefaultExt = FileExtension;
        this.saveFileDialog.Filter = Filter;
        if( !string.IsNullOrEmpty(newFileName) ) {
          this.saveFileDialog.InitialDirectory = Path.GetDirectoryName(newFileName);
          this.saveFileDialog.FileName = Path.GetFileName(newFileName);
        }
        else {
      
            this.saveFileDialog.FileName = this.DefaultFileName/* DefaultFileNameAndVersion*/;
        }

        DialogResult res = this.saveFileDialog.ShowDialog(this.host);
        if( res != DialogResult.OK ) return false;
        newFileName = this.saveFileDialog.FileName;
      }

这段代码只能保存一种默认格式吗?如果我想加入一种jpg格式的保存,应该怎么改呢?

回复 论坛版权

使用道具 举报

sisuo366 发表于 2017-8-14 16:22:36 | 显示全部楼层
*.Filter = "PDF文件|*.pdf";中间还可以加上其他的类型,自己去搜一下。。这个就是PDF格式的
您需要登录后才可以回帖 登录 | 加入CSkin博客

本版积分规则

QQ|申请友链|小黑屋|手机版|Archiver|CSkin ( 粤ICP备13070794号

Powered by Discuz! X3.2  © 2001-2013 Comsenz Inc.  Designed by ARTERY.cn
GMT+8, 2024-3-29 16:06, Processed in 0.551507 second(s), 29 queries , Gzip On.

快速回复 返回顶部 返回列表