国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

c#保存文件時候的彈出選擇要保存的文件夾帶新建文件夾效果的類代碼

2024-07-21 02:25:58
字體:
來源:轉載
供稿:網友

添加引用system.design.dll

//選擇文件的保存路徑
   dirbrowser   olderbrowserdlg=new   dirbrowser();  
   
   if (folderbrowserdlg.showdialog()==dialogresult.ok)
   {
    txtfilepath.text = folderbrowserdlg.selectedpath;
   }

//

using system.windows.forms.design;
using system.windows.forms;
using system;
 

//一般選擇文件保存地址都用彈出對話框來進行選擇
public class directoryselect : foldernameeditor
{
 private folderbrowser fb = new folderbrowser();
 private string fdescription = "choose directory";
 private string freturnpath = string.empty;
 
 public string description
 {
  set { fdescription = value; }
  get { return fdescription; }
 }
 
 public string returnpath
 {
  get { return freturnpath; }
 }
 
 public directoryselect()
 {
 
 }
 
 private dialogresult rundialog()
 {
  fb.description = this.description;
  fb.startlocation = folderbrowserfolder.mycomputer;
  fb.style = folderbrowserstyles.restricttosubfolders;
  //|folderbrowserstyles.restricttodomain;
  return fb.showdialog();
 }
 
 public dialogresult showdialog()
 {
  dialogresult dres = dialogresult.none;
  dres = rundialog();
  if (dres == dialogresult.ok)
   this.freturnpath = fb.directorypath;
  else
   this.freturnpath = string.empty;
  return dres;
 }
}

//一般選擇文件保存地址都用彈出對話框來進行選擇
//調用  
//dirbrowser   mydirbrowser=new   dirbrowser();  
//if(mydirbrowser.showdialog()!=dialogresult.cancel)  
//messagebox.show(mydirbrowser.returnpath);  

public   class   dirbrowser   :   foldernameeditor    
{    
 folderbrowser   fb   =   new   folderbrowser();    
 public   string   description    
 {    
  set   {   _description   =   value;   }    
  get   {   return   _description;   }    
 }    
     
 public   string   returnpath    
 {    
  get   {   return   _returnpath;   }    
 }    
     
 public   dirbrowser()   {   }    
 public   dialogresult   showdialog()    
 {    
  fb.description   =   _description;    
  fb.startlocation   =   folderbrowserfolder.mycomputer;    
  dialogresult   r   =   fb.showdialog();    
  if   (r   ==   dialogresult.ok)    
   _returnpath   =   fb.directorypath;    
  else    
   _returnpath   =   string.empty;    
     
  return   r;    
 }    
   
 //private   string   _description   =   "choose   directory";    
 //private   string   _returnpath   =   string.empty; 
 private   string   _description   =   "請選擇文件夾";    
 private   string   _returnpath   =   string.empty; 
}

 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 临漳县| 马公市| 江安县| 额尔古纳市| 太保市| 应城市| 清流县| 昌吉市| 来凤县| 冕宁县| 军事| 广西| 宜兰市| 哈巴河县| 上饶市| 密山市| 芷江| 叙永县| 苍山县| 河北区| 来凤县| 田东县| 秀山| 东宁县| 玉山县| 监利县| 丁青县| 华池县| 高邑县| 晋州市| 嫩江县| 新沂市| 德惠市| 黄大仙区| 喀什市| 广东省| 湟源县| 南丹县| 怀远县| 马鞍山市| 延津县|