当前位置: 首页>>代码示例>>C#>>正文


C# FolderBrowserDialog.ToString方法代码示例

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


在下文中一共展示了FolderBrowserDialog.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: addNewDirectoryToolStripMenuItem_Click

        private void addNewDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();
            DialogResult result = fbd.ShowDialog();

            string[] files = Directory.GetFiles(fbd.SelectedPath);
            List<FileModel> dirFiles = new List<FileModel>();
            for(int i = 0; i < files.Length; i++)
            {
                FileModel theFile = new FileModel();
                theFile.Path = files[i].ToString();
                theFile.Name = new FileInfo(files[i]).Name;
                theFile.Size = new FileInfo(files[i]).Length;
                dirFiles.Add(theFile);
            }
            StaticValues.self.Files.Add(new DirectoryModel(fbd.SelectedPath, fbd.ToString(), dirFiles));
        }
开发者ID:FeodalherreN,项目名称:DCSharp,代码行数:17,代码来源:DCSharp.cs

示例2: at

		/* a few people have been seeing the following:
Failures:
1) MonoTests.System.Windows.Forms.CommonDialogsTest.FolderBrowserDialogTest : System.ArgumentException : oldValue is the empty string.
  at System.String.Replace (System.String oldValue, System.String newValue) [0x00054] in /tmp/scratch/BUILD/mono-1.2.70507/mcs/class/corlib/System/String.cs:1285 
  at System.Windows.Forms.FolderBrowserDialog+FolderBrowserTreeView.SetSelectedPath (System.String path) [0x00061] in /tmp/scratch/BUILD/mono-1.2.70507/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs:460 
  at System.Windows.Forms.FolderBrowserDialog+FolderBrowserTreeView.set_SelectedPath (System.String value) [0x0000c] in /tmp/scratch/BUILD/mono-1.2.70507/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs:363 
  at (wrapper remoting-invoke-with-check) FolderBrowserTreeView:set_SelectedPath (string)
  at System.Windows.Forms.FolderBrowserDialog.set_SelectedPath (System.String value) [0x0001a] in /tmp/scratch/BUILD/mono-1.2.70507/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs:223 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.FolderBrowserDialog:set_SelectedPath (string)
  at MonoTests.System.Windows.Forms.CommonDialogsTest.FolderBrowserDialogTest () [0x00094] in /tmp/scratch/BUILD/mono-1.2.70507/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/CommonDialogsTest.cs:260 
  at <0x00000> <unknown method>
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00040] in /tmp/scratch/BUILD/mono-1.2.70507/mcs/class/corlib/System.Reflection/MonoMethod.cs:143 
		*/
		public void FolderBrowserDialogTest ()
		{
			fbd = new FolderBrowserDialog ();
			
			Assert.AreEqual ("", fbd.Description, "#83");
			
			Assert.AreEqual (Environment.SpecialFolder.Desktop, fbd.RootFolder, "#84");
			
			Assert.AreEqual ("", fbd.SelectedPath, "#85");
			
			Assert.IsTrue (fbd.ShowNewFolderButton, "#86");
			
			Assert.AreEqual ("System.Windows.Forms.FolderBrowserDialog", fbd.ToString (), "#87");
			
			string current_path = Environment.CurrentDirectory;
			fbd.SelectedPath = current_path;
			
			Assert.AreEqual (current_path, fbd.SelectedPath, "#89");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:33,代码来源:CommonDialogsTest.cs


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