當前位置: 首頁>>代碼示例>>C#>>正文


C# Forms.FolderBrowserDialog類代碼示例

本文整理匯總了C#中System.Windows.Forms.FolderBrowserDialog的典型用法代碼示例。如果您正苦於以下問題:C# FolderBrowserDialog類的具體用法?C# FolderBrowserDialog怎麽用?C# FolderBrowserDialog使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FolderBrowserDialog類屬於System.Windows.Forms命名空間,在下文中一共展示了FolderBrowserDialog類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: btnInputFolder_Click

        private void btnInputFolder_Click(object sender, RoutedEventArgs e)
        {
            var fbd = new FolderBrowserDialog
            {
                SelectedPath =
                    Directory.Exists(txtInputFolder.Text)
                        ? txtInputFolder.Text
                        : VariousFunctions.GetApplicationLocation()
            };
            if (fbd.ShowDialog() != DialogResult.OK) return;

            SelectedPlugins.Clear();
            txtInputFolder.Text = fbd.SelectedPath;

            var di = new DirectoryInfo(txtInputFolder.Text);
            FileInfo[] fis = di.GetFiles();
            foreach (
                FileInfo fi in
                    fis.Where(
                        fi =>
                            (fi.Name.EndsWith(".asc") || fi.Name.EndsWith(".alt") || fi.Name.EndsWith(".ent") || fi.Name.EndsWith(".xml")) &&
                            Path.GetFileNameWithoutExtension(fi.Name).Length == 4))
            {
                SelectedPlugins.Add(new PluginEntry
                {
                    IsSelected = true,
                    LocalMapPath = fi.FullName,
                    PluginClassMagic = fi.Name.Remove(fi.Name.Length - 3)
                });
            }
        }
開發者ID:Nibre,項目名稱:Assembly,代碼行數:31,代碼來源:HaloPluginConverter.xaml.cs

示例2: BrowseClick

        private void BrowseClick(object sender, EventArgs e)
        {
            var browseDialog = new FolderBrowserDialog();

            if (browseDialog.ShowDialog() == DialogResult.OK)
                Directory.Text = browseDialog.SelectedPath;
        }
開發者ID:jmagnetti,項目名稱:gitextensions,代碼行數:7,代碼來源:FormInit.cs

示例3: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            // Der Dialog zur Auswahl eines beliebigen Log-Verzeichnisses wird angeboten.

            System.Windows.Forms.FolderBrowserDialog objDialog = new FolderBrowserDialog();
            objDialog.Description = "Wählen Sie ein Exportverzeichnis. \nDer Inhalt einer evtl. vorhandenen Datei wird überschrieben.";
            objDialog.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            // Nur wenn in dem FolderBrowserDialog tatsächlich mit OK ein Pfad gewählt wurde,
            // kommt es zum Export.

            if (objDialog.ShowDialog() == DialogResult.OK)
            {
                // Export

                string exportverzeichnis = Path.Combine(objDialog.SelectedPath, "alias.csv");

                TextWriter tw = new StreamWriter(exportverzeichnis);

                for (int i = 0; i < Global.AliasMail.Count(); i++)
                {
                    tw.WriteLine("" + Global.AliasMail[i].Email + ", " + Global.AliasMail[i].Kürzel + ", " + Global.AliasMail[i].Name + ", " + Global.AliasMail[i].Alias1 + ", " + Global.AliasMail[i].Alias2 + ", " + Global.AliasMail[i].Alias3 + ", " + Global.AliasMail[i].Alias4 + "");
                }
                tw.Close();
            }
        }
開發者ID:stbaeumer,項目名稱:serienbriefmailer,代碼行數:26,代碼來源:frmVerteiler.cs

示例4: btnExport_Click

 private void btnExport_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog fbd = new FolderBrowserDialog();
     DialogResult result = fbd.ShowDialog();
     if (result == DialogResult.Cancel) {
         //do nothing, cancel was clicked
     } else if (fbd.SelectedPath != null) {
         if (Directory.GetFiles(fbd.SelectedPath).Length == 0) {
             int count = 0;
             foreach (ListViewItem item in lvExport.Items) {
                 try {
                     string source = item.ImageKey + @"\" + item.SubItems[3].Text + ".jpg";
                     string destination = fbd.SelectedPath + @"\"
                         + item.SubItems[1].Text + "-"       //firstname
                         + item.Text + "-"                   //last name
                         + item.SubItems[2].Text + "-"       //grade
                         + item.SubItems[3].Text             //ID
                         + ".jpg";
                     File.Copy(source, destination);
                     count++;
                 } catch (Exception) {
                     //skip that one, probably an IOException due to file exists already
                     //HOWEVER, 2013-14 missed 1 file
                 }
             }
             MessageBox.Show("Copied " + count + " picture" + (count == 1 ? "." : "s."));
         } else {
             string error = "Files exist in the folder you selected.\n\nPlease create or select an empty folder and try again.";
             string caption = "Choose an Empty Folder";
             MessageBox.Show(error, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
開發者ID:JamesWClark,項目名稱:RHS,代碼行數:33,代碼來源:Main.cs

示例5: btnNew_Click

        private void btnNew_Click(object sender, EventArgs e)
        {
            // 獲取文件夾絕對路徑    顯示在 txtbox 控件裏

            System.Windows.Forms.FolderBrowserDialog folder = new System.Windows.Forms.FolderBrowserDialog();

            string StrFileName = "";
            // 獲取文件和路徑名 一起顯示在 txtbox 控件裏

            OpenFileDialog dialog = new OpenFileDialog();
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string SavePathFile = AppDomain.CurrentDomain.BaseDirectory + "\\image\\gdc" +DateTime.Now.ToString("yyyyMMddHHmmss")+ ".jpg";
                StrFileName = dialog.SafeFileName;
                if (File.Exists(SavePathFile))
                {
                    File.Delete(SavePathFile);
                } File.Copy( dialog.FileName,SavePathFile);
                if (!db.InsertH_Para("H_gdc", "gdc" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg", db.GetMaxID("gdc", "H_gdc")))
                {
                    MessageBox.Show("保存失敗!"); return;
                }
                else
                {
                    MessageBox.Show("保存成功!");
                    ShowDt(PageInt);
                }
            }
        }
開發者ID:SpiderLoveFish,項目名稱:HZLApp,代碼行數:29,代碼來源:gdc.cs

示例6: cmdBatch_Click

        private void cmdBatch_Click(object sender, EventArgs e)
        {
            try
            {
                FolderBrowserDialog dlgFolder = new FolderBrowserDialog();

                dlgFolder.Description = "Batch files all image files from this folder.";

                if (dlgFolder.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    DirectoryInfo dirInfo = new DirectoryInfo(dlgFolder.SelectedPath.ToString());

                    FileInfo[] ImageFiles = dirInfo.GetFiles("*.jpg").Concat(dirInfo.GetFiles("*.jpeg")).Concat(dirInfo.GetFiles("*.png")).ToArray();

                    for (int i = 0; i < ImageFiles.Length; ++i)
                    {
                        FileInfo ImageFile = ImageFiles[i];
                        Bitmap ImageBitmap = new Bitmap(ImageFile.FullName);

                        ProcessImage(ImageBitmap);
                    }

                    MessageBox.Show("Image Files Process Completed", "Process Completed", MessageBoxButtons.OK);
                }
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
        }
開發者ID:Blissgig,項目名稱:CaptureCrop,代碼行數:30,代碼來源:Form1.cs

示例7: Execute

        public void Execute(IMenuCommand command)
        {
            IDiagram diagram = this.DiagramContext.CurrentDiagram;
            IModelStore modelStore = diagram.ModelStore;

            string SqlFile = @"C:\MyLoStore\MyLoStorePostgres.sql";
            string PythonFile = @"C:\MyLoStore\MyLoStore.py";

            FolderBrowserDialog openFolderDialog1 = new FolderBrowserDialog();
            openFolderDialog1.RootFolder = Environment.SpecialFolder.MyComputer;
            openFolderDialog1.Description =
                "Select the directory that you want to use for generated output";

            if (openFolderDialog1.ShowDialog() == DialogResult.OK)
            {
                string folderName = openFolderDialog1.SelectedPath;
                SqlFile = folderName + @"\MyLoStorePostgres.sql";
                PythonFile = folderName + @"\MyLoStore.py";

                using (StreamWriter fsSql = new StreamWriter(SqlFile, false))
                {
                    using (StreamWriter fsPy = new StreamWriter(PythonFile, false))
                    {

                        SQLWriter mySql = new SQLWriter(SQLGenerateRun.Postgres);
                        PythonClassWriter py = new PythonClassWriter();
                        SQLGenerator sqlGen = new SQLGenerator(fsSql, mySql, fsPy, py, modelStore);
                        sqlGen.GenerateMySQL();
                    }
                }
            }
        }
開發者ID:keithshort1,項目名稱:MyLoProto,代碼行數:32,代碼來源:GenerateMenuPostgres.cs

示例8: btnBrowser_Click

 private void btnBrowser_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog path = new FolderBrowserDialog();
     //path.RootFolder = Environment.SpecialFolder.;
     path.ShowDialog();
     txtFrom.Text = path.SelectedPath;
 }
開發者ID:chrislin123,項目名稱:ChrisTools,代碼行數:7,代碼來源:CheckOver4g.cs

示例9: BtnExportAll_Click

 private void BtnExportAll_Click(object sender, System.EventArgs e)
 {
     using (FolderBrowserDialog browserDlg = new FolderBrowserDialog())
     {
         browserDlg.Description = "Export all files";
         if (browserDlg.ShowDialog() == DialogResult.OK)
         {
             foreach (OContainer.fileEntry file in container.content)
             {
                 string fileName = Path.Combine(browserDlg.SelectedPath, file.name);
                 string dir = Path.GetDirectoryName(fileName);
                 if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
                 if (file.loadFromDisk)
                 {
                     byte[] buffer = new byte[file.fileLength];
                     container.data.Seek(file.fileOffset, SeekOrigin.Begin);
                     container.data.Read(buffer, 0, buffer.Length);
                     File.WriteAllBytes(fileName, buffer);
                 }
                 else
                     File.WriteAllBytes(fileName, file.data);
             }
         }
     }
 }
開發者ID:CryogenicTyrant,項目名稱:Ohana3DS-Rebirth,代碼行數:25,代碼來源:OContainerPanel.cs

示例10: CleaningInterface

 public CleaningInterface()
 {
     InitializeComponent();
     this.m_directoryBrowser = new FolderBrowserDialog();
     this.registry = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"Software\FileNameCleaner");
     this.SetDirectory(this.LastDirectory);
 }
開發者ID:jefking,項目名稱:File-Name-Cleaner,代碼行數:7,代碼來源:CleaningInterface.cs

示例11: btnChooseDir_Click

 private void btnChooseDir_Click(object sender, RoutedEventArgs e)
 {
     var dialog = new FolderBrowserDialog();
     dialog.ShowDialog();
     if (dialog.SelectedPath.IsNullOrEmpty()) return;
     MainData.Path = dialog.SelectedPath;
 }
開發者ID:yan122725529,項目名稱:AbizWork,代碼行數:7,代碼來源:MainWindow.xaml.cs

示例12: BrowseButtonOnClick

 private void BrowseButtonOnClick(object sender, EventArgs eventArgs)
 {
     FolderBrowserDialog fbd = new FolderBrowserDialog();
     if (fbd.ShowDialog() == DialogResult.OK){
         textBox1.Text = fbd.SelectedPath;
     }
 }
開發者ID:JurgenCox,項目名稱:compbio-base,代碼行數:7,代碼來源:FolderQueryForm.cs

示例13: MainWindow

        public MainWindow()
        {
            InitializeComponent();
            openFolderDialog = new FolderBrowserDialog();
            openFolderDialog.Description = "Podaj katalog z przykładami";
            openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "*JPEG|*.jpg|Wszystkie pliki|*.*";
            openFileDialog.Title = "Podaj plik przeznaczony do rozponania";

            ojIterations = 10;
            iterationsText.Text = ojIterations.ToString();
            printLineDelegate = printByDispatcher;
            saveImagesDelegate = saveImages;
            createLearningExamplesDelegate = createLearningExamples;
            getFilesDelegate = getFiles;
            setExamplesDelegate = setExamples;
            OnStateChange = stateChange;
            OnReductionFinished = reductionFinished;
            OnReductionStarted = reductionStarted;
            files = null;
            learnButton.IsEnabled = false;
            compareButton.IsEnabled = false;
            outputDimension = 7;
            dimensionText.Text = outputDimension.ToString();

            dataBaseFileName = "C:\\database.db";
            dataBasePathText.Text = dataBaseFileName;
            getDataBaseFileNameDelegate += DBFN;

            examplesHeight = 0;
            examplesWidth = 0;
        }
開發者ID:robwoj,項目名稱:sieci-neuronowe,代碼行數:32,代碼來源:MainWindow.xaml.cs

示例14: btnBrowseDir_Click

		private void btnBrowseDir_Click(object sender, RoutedEventArgs e) {
			var dialog = new FolderBrowserDialog {
				Description = "Select the directory containing PCSX2"
			};
			if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
				tbPcsx2Dir.Text = dialog.SelectedPath;
		}
開發者ID:CyberFoxHax,項目名稱:PCSXBonus,代碼行數:7,代碼來源:wndSettings.xaml.cs

示例15: button10_Click

 private void button10_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog dlg = new FolderBrowserDialog();
     dlg.SelectedPath = Application.StartupPath + "\\Output";
     dlg.ShowDialog();
     textBox8.Text = dlg.SelectedPath;
 }
開發者ID:zorgTeam,項目名稱:OpcodeDecompiler,代碼行數:7,代碼來源:Form1.cs


注:本文中的System.Windows.Forms.FolderBrowserDialog類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。