代码改变世界

SaveFileDialog

2011-04-20 01:17  观海看云  阅读(294)  评论(0编辑  收藏  举报
// Configure save file dialog box
  
  Microsoft.Win32.SaveFileDialog dlg 
= new Microsoft.Win32.SaveFileDialog();
  dlg.FileName 
= "Document"// Default file name
  
  dlg.DefaultExt 
= ".text"// Default file extension
  
  dlg.Filter 
= "Text documents (.txt)|*.txt"// Filter files by extension
  
  
  
// Show save file dialog box
  
  Nullable
<bool> result = dlg.ShowDialog();
  
  
// Process save file dialog box results
  
  
if (result == true)
  {
      
// Save document
  
      
string filename = dlg.FileName;
  }