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


C# Forms.FileDialog类代码示例

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


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

示例1: EditValue

 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if ((provider != null) && (((IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService))) != null))
     {
         if (this.fileDialog == null)
         {
             this.fileDialog = new OpenFileDialog();
             string str = CreateFilterEntry(this);
             for (int i = 0; i < imageExtenders.Length; i++)
             {
             }
             this.fileDialog.Filter = str;
         }
         IntPtr focus = System.Drawing.Design.UnsafeNativeMethods.GetFocus();
         try
         {
             if (this.fileDialog.ShowDialog() == DialogResult.OK)
             {
                 FileStream stream = new FileStream(this.fileDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
                 value = this.LoadFromStream(stream);
             }
         }
         finally
         {
             if (focus != IntPtr.Zero)
             {
                 System.Drawing.Design.UnsafeNativeMethods.SetFocus(new HandleRef(null, focus));
             }
         }
     }
     return value;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:IconEditor.cs

示例2: CustomOpenFileDialog

		const int DialogWidth = 460; // predefined/desired width
		
		public CustomOpenFileDialog (FileDialog dialog, OpenFileDialogData data)
			: base (dialog)
		{
			Initialize (data);
			
			StartLocation = AddonWindowLocation.Bottom;
		}
开发者ID:louissalin,项目名称:monodevelop,代码行数:9,代码来源:CustomOpenFileDialog.cs

示例3: imageOCRTest

 public void imageOCRTest(FileDialog openImageDialog )
 {
     DialogResult ImageResult = openImageDialog.ShowDialog();
      if (ImageResult == DialogResult.OK)
      {
          String testImagePath = openImageDialog.FileName;
          try
          {
              using (var tEngine = new TesseractEngine("C:\\Users\\yeghiakoronian\\Documents\\visual studio 2013\\Projects\\NLP Genre Recogition\\NLP Genre Recogition\\tessdata", "eng", EngineMode.Default)) //creating the tesseract OCR engine with English as the language
              {
                  using (var img = Pix.LoadFromFile(testImagePath)) // Load of the image file from the Pix object which is a wrapper for Leptonica PIX structure
                  {
                      using (var page = tEngine.Process(img)) //process the specified image
                      {
                          String text = page.GetText(); //Gets the image's content as plain text.
                          MessageBox.Show(text);
                          getGenreOfSong(text);
                          //  Console.ReadKey();
                      }
                  }
              }
          }
          catch (IOException)
          {
              MessageBox.Show("Woops Cant Open The File", "COMP 6781: NLP", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
          }
      }
 }
开发者ID:yeghiakoronian,项目名称:MusicGenreClassifier,代码行数:28,代码来源:mainFormFunctions.cs

示例4: AmbilFile

        private void AmbilFile(FileDialog dialog, TextBox control, bool useFilter)
        {
            if (useFilter) { dialog.Filter = "Wave Audio (*.wav)|*.wav"; }
            if (dialog.ShowDialog(this) == DialogResult.OK)

                control.Text = dialog.FileName;
        }
开发者ID:razhou,项目名称:STEGANOGRAPHY-AUDIO-WAV,代码行数:7,代码来源:frmStegano.cs

示例5: StartDialog

		private static DialogResult StartDialog(FileDialog dialog, string extension, string description)
		{
			dialog.AddExtension = true;
			dialog.DefaultExt = extension;
			dialog.Filter = string.Format("{0}(*{1})|*{1}", description, extension);
			var result = dialog.ShowDialog();
			return result;
		}
开发者ID:UnresolvedExternal,项目名称:ImageSearcher,代码行数:8,代码来源:StoreEditor.cs

示例6: FileDialogButton

        public FileDialogButton()
        {
            InitializeComponent();

            _dialog = new OpenFileDialog
            {
                Filter = "All files (*.*)|*.*"
            };
        }
开发者ID:ReMinoer,项目名称:FormPlug,代码行数:9,代码来源:FileDialogButton.cs

示例7: STAShowDialog

 private DialogResult STAShowDialog(FileDialog dialog)
 {
     DialogState state = new DialogState();
     state.dialog = dialog;
     System.Threading.Thread t = new System.Threading.Thread(state.ThreadProcShowDialog);
     t.SetApartmentState(System.Threading.ApartmentState.STA);
     t.Start();
     t.Join();
     return state.result;
 }
开发者ID:truonghinh,项目名称:TnX,代码行数:10,代码来源:FrmImportDataFromXml.cs

示例8: OpenFileDialogEx

        public OpenFileDialogEx (FileDialog fileDialog)
        {
			if (fileDialog == null)
				throw new ArgumentNullException ("fileDialog");
			
            InitializeComponent();
//            dlgOpen.AutoUpgradeEnabled = false; 
            //SetStyle(ControlStyles.SupportsTransparentBackColor, true);
			
			this.fileDialog = fileDialog;
        }
开发者ID:hduregger,项目名称:monodevelop,代码行数:11,代码来源:OpenFileDialogEx.cs

示例9: SetFileDialogProperties

        private static void SetFileDialogProperties(FileDialog dialog)
        {
            dialog.Filter = PROJECT_FILTER;

            var recentProjects = Settings.Default.RecentProjects;

            if (recentProjects != null && recentProjects.Count > 0)
            {
                dialog.InitialDirectory = Path.GetDirectoryName(recentProjects[0]);
            }
        }
开发者ID:frankgit,项目名称:NChanges,代码行数:11,代码来源:ApiChangesForm.cs

示例10: Prompts

        public Prompts(OpenFileDialog openDialog, SaveFileDialog saveDialog, ILog log, IEnumerable<IPathStore> store)
        {
            Log = log;
            Stores = store;

            this.openDialog = openDialog;
            this.saveDialog = saveDialog;

            Fallout3Path = TryAllStoresGetPath("Fallout3");
            FalloutNVPath = TryAllStoresGetPath("FalloutNV");
            TTWSavePath = TryAllStoresGetPath("TaleOfTwoWastelands");
        }
开发者ID:WCapelle,项目名称:ttwinstaller,代码行数:12,代码来源:Prompts.cs

示例11: CustomOpenFileDialog

		public CustomOpenFileDialog (FileDialog dialog, OpenFileDialogData data)
			: base (dialog)
		{
			Initialize (data);
			
			StartLocation = AddonWindowLocation.Bottom;

			// Use the classic dialogs, as the new ones (WPF based) can't handle child controls.
			if (data.ShowEncodingSelector || data.ShowViewerSelector) {
				dialog.AutoUpgradeEnabled = false;
			}
		}
开发者ID:segaman,项目名称:monodevelop,代码行数:12,代码来源:CustomOpenFileDialog.cs

示例12: PrepareFileDialog

		private static void PrepareFileDialog(FileDialog dialog, FileDialogCreationArgs args)
		{
			dialog.AddExtension = !string.IsNullOrEmpty(args.FileExtension);
			dialog.DefaultExt = args.FileExtension;
			dialog.FileName = args.FileName;
			dialog.InitialDirectory = args.Directory;
			dialog.RestoreDirectory = true;
			dialog.Title = args.Title;

			dialog.Filter = StringUtilities.Combine(args.Filters, "|",
			                                        f => f.Description + "|" + f.Filter);
		}
开发者ID:jasper-yeh,项目名称:ClearCanvas,代码行数:12,代码来源:ExtendedOpenFilesDialogProvider.cs

示例13: FileButtonClick

 private void FileButtonClick(TextBox textBox, FileDialog dialog)
 {
     var result = dialog.ShowDialog();
     if (result == System.Windows.Forms.DialogResult.OK)
     {
         textBox.Text = dialog.FileName;
     }
     else
     {
         textBox.Text = "";
     }
 }
开发者ID:GiveCampUK,项目名称:PPT_2,代码行数:12,代码来源:Form1.cs

示例14: FileDialog

 /// <summary>
 /// Opens a "FileDialog" prompt window and returns the Dialog Result if blocking, otherwise DialogResult.OK.
 /// Call will block if a delegate isn't passed.
 /// </summary>
 /// <param name="fd">Reference of a FileDialog </param>
 /// <param name="onfinish">If a delegate is passed, then it doesn't block.</param>
 /// <returns></returns>
 public static DialogResult FileDialog(ref FileDialog fd, onDialogFinished onfinish = null)
 {
     DialogResult dr = new DialogResult();
     Oper o = new Oper(ref fd, ref dr) {_callback = onfinish};
     Thread thread = new Thread(() => FileDialog_DoWork(o));
     thread.SetApartmentState(ApartmentState.STA);
     thread.Start();
     if (onfinish != null)
         return DialogResult.OK;
     while (!o._isFinished)
         Thread.Sleep(100);
     return o._dr;
 }
开发者ID:souxiaosou,项目名称:OmniEngine.Net,代码行数:20,代码来源:Dialogs.cs

示例15: extractStrings

 private void extractStrings(FileDialog fileDialog)
 {
     try
     {
         fileLocationAndFileName = fileDialog.FileName;
         fileLocation = Path.GetDirectoryName(fileLocationAndFileName);
         fileName = Path.GetFileName(fileLocationAndFileName);
         _blFileFound = true;
     }
     catch (Exception)
     {
         _blFileFound = false;
     }
 }
开发者ID:yoflippo,项目名称:btlabjackstreamer,代码行数:14,代码来源:FileHandling.cs


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