• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.FolderBrowserDialog类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Forms.FolderBrowserDialog的典型用法代码示例。如果您正苦于以下问题:C# FolderBrowserDialog类的具体用法?C# FolderBrowserDialog怎么用?C# FolderBrowserDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FolderBrowserDialog类属于System.Windows.Forms命名空间,在下文中一共展示了FolderBrowserDialog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: SetFolderBrowserProperties

		static void SetFolderBrowserProperties (SelectFileDialogData data, FolderBrowserDialog dialog)
		{
			if (!string.IsNullOrEmpty (data.Title))
				dialog.Description = data.Title;
			
			dialog.SelectedPath = data.CurrentFolder;
		}
开发者ID:louissalin,项目名称:monodevelop,代码行数:7,代码来源:SelectFileDialogHandler.cs


示例17: btnPackInputBrowse_Click

        private void btnPackInputBrowse_Click(object sender, System.EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                tbPackInput.Text = fbd.SelectedPath;
        }
开发者ID:LITTOMA,项目名称:libwiisharp,代码行数:7,代码来源:U8_UnPacker_Example.cs


示例18: FolderBrowserDialogUITypeEditor

 /// <summary>
 /// Constructor with dialog description</summary>
 /// <param name="description">Dialog description</param>
 public FolderBrowserDialogUITypeEditor(string description)
 {
     // create instance of editing control, 
     // resuse this instance for subsequence calls
     m_dialog = new FolderBrowserDialog();
     m_dialog.Description = description;
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:10,代码来源:FolderBrowserDialogUITypeEditor.cs


示例19: FolderStore_Click

        private void FolderStore_Click(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog FolderDialog = new FolderBrowserDialog();
            FolderDialog.ShowDialog();

            FolderSave = FolderDialog.SelectedPath;
        }
开发者ID:JKord,项目名称:ArchiverRevolution,代码行数:7,代码来源:MainWindow.xaml.cs


示例20: BtnAdd_Click

        private void BtnAdd_Click(object sender, EventArgs e)
        {
            var dialog =
                new FolderBrowserDialog
                    {
                        Description = "Select a folder",
                        RootFolder = Environment.SpecialFolder.Desktop,
                        ShowNewFolderButton = false
                    };
            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                var folder = dialog.SelectedPath;

                // Check for duplicates
                var bDuplicate = false;
                foreach (ListViewItem item in m_lstFolders.Items)
                {
                    if (string.Compare(folder, item.Text, StringComparison.OrdinalIgnoreCase) != 0)
                        continue;

                    bDuplicate = true;
                    break;
                }

                // Add item to ListView
                if (!bDuplicate)
                    m_lstFolders.Items.Add(folder);
            }
            dialog.Dispose();
        }
开发者ID:arsaccol,项目名称:SLED,代码行数:30,代码来源:SledMultiFolderSelectionForm.cs



注:本文中的System.Windows.Forms.FolderBrowserDialog类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.FontDialog类代码示例发布时间:2022-05-26
下一篇:
C# Forms.FlowLayoutPanel类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap