當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。