Dialogs.cs 793 B

123456789101112131415161718192021222324252627
  1. using System.Windows.Forms;
  2. namespace FastReport.Utils
  3. {
  4. internal static class Dialogs
  5. {
  6. public static bool OpenImage(out string fileName)
  7. {
  8. using (OpenFileDialog dialog = new OpenFileDialog())
  9. {
  10. var filter = Res.Get("FileFilters,Images");
  11. #if AVALONIA
  12. filter = filter.Replace("*.tiff;", "").Replace("*.tif;", "").Replace("*.emf;", "").Replace("*.wmf;", "").Replace("*.ico;", "");
  13. #endif
  14. dialog.Filter = filter;
  15. if (dialog.ShowDialog() == DialogResult.OK)
  16. {
  17. fileName = dialog.FileName;
  18. return true;
  19. }
  20. }
  21. fileName = null;
  22. return false;
  23. }
  24. }
  25. }