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格式的保存,应该怎么改呢?
|