Extensions Property

Summary
Gets the extension that will be used when filtering the files that will be displayed.
Syntax
C#
C++/CLI
public string Extensions { get; set; } 
public: 
property String^ Extensions { 
   String^ get(); 
   void set (    String^ value); 
} 

Property Value

The extension that will be used when filtering the files that will be displayed.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.WinForms.CommonDialogs.File; 
 
 
public void RasterOpenDialogExample() 
{ 
   RasterCodecs rasterCodecs = new RasterCodecs(); 
 
   RasterOpenDialog openDlg = new RasterOpenDialog(rasterCodecs); 
 
   RasterOpenDialogLoadFormat firstFilter = new RasterOpenDialogLoadFormat(); 
   firstFilter.Name = "All Files"; 
   firstFilter.Extensions = "*.*"; 
   openDlg.Filter = new RasterOpenDialogLoadFormat[] 
   { 
      firstFilter, 
      new RasterOpenDialogLoadFormat("LEAD", "*.cmp") //second filter 
   }; 
 
   openDlg.CheckFileExists = true; 
   openDlg.CheckPathExists = true; 
   openDlg.DefaultExt = "cmp"; 
   openDlg.DereferenceLinks = true; 
   openDlg.EnableSizing = true; 
   openDlg.FileName = "Image1.cmp"; 
   openDlg.FilterIndex = 2; 
   openDlg.GenerateThumbnail = false; 
   openDlg.InitialDirectory = LEAD_VARS.ImagesDir; 
   openDlg.InitialView = FileDialogInitialView.List; 
   openDlg.LoadCompressed = true; 
   openDlg.LoadFileImage = false; 
   openDlg.LoadOptions = false; 
   openDlg.LoadRotated = false; 
   openDlg.Multiselect = true; 
   openDlg.PreviewWindowVisible = true; 
   openDlg.ShowDeletePage = true; 
   openDlg.ShowFileInformation = true; 
   openDlg.ShowGeneralOptions = true; 
   openDlg.ShowHelp = true; 
   openDlg.ShowLoadCompressed = true; 
   openDlg.ShowLoadOptions = true; 
   openDlg.ShowLoadRotated = true; 
   openDlg.ShowMultipage = true; 
   openDlg.ShowPdfOptions = true; 
   openDlg.ShowXpsOptions = true; 
   openDlg.ShowXlsOptions = true; 
   openDlg.ShowVffOptions = true; 
   openDlg.ShowAnzOptions = true; 
   openDlg.ShowVectorOptions = true; 
   openDlg.ShowPreview = true; 
   openDlg.ShowProgressive = true; 
   openDlg.ShowRasterOptions = true; 
   openDlg.ShowTotalPages = true; 
   openDlg.Title = "Open Dialog"; 
   openDlg.UseFileStamptoPreview = true; 
   openDlg.Help += new EventHandler<RasterDialogHelpEventArgs>(openDlg_Help); 
   openDlg.LoadCorrupted = true; 
   openDlg.ShowLoadMultithreaded = true; 
   openDlg.ShowRasterizeDocumentOptions = true; 
   // if you set "openDlg.LoadFileImage = true" this event will be fired 
   openDlg.LoadProgress += new EventHandler<RasterDialogLoadProgressEventArgs>(openDlg_LoadProgress); 
 
   if (DialogResult.OK == openDlg.ShowDialog(null)) 
   { 
      for (int i = 0; i < openDlg.OpenedFileData.Count; i++) 
      { 
         RasterDialogFileData fileDataItem = openDlg.OpenedFileData[i]; 
 
         // this is not an image file. 
         if (fileDataItem.Options == null) 
         { 
            continue; 
         } 
 
         rasterCodecs.Options.RasterizeDocument.Load.PageWidth = fileDataItem.Options.RasterizeDocumentOptions.PageWidth; 
         rasterCodecs.Options.RasterizeDocument.Load.PageHeight = fileDataItem.Options.RasterizeDocumentOptions.PageHeight; 
         rasterCodecs.Options.RasterizeDocument.Load.LeftMargin = fileDataItem.Options.RasterizeDocumentOptions.LeftMargin; 
         rasterCodecs.Options.RasterizeDocument.Load.TopMargin = fileDataItem.Options.RasterizeDocumentOptions.TopMargin; 
         rasterCodecs.Options.RasterizeDocument.Load.RightMargin = fileDataItem.Options.RasterizeDocumentOptions.RightMargin; 
         rasterCodecs.Options.RasterizeDocument.Load.BottomMargin = fileDataItem.Options.RasterizeDocumentOptions.BottomMargin; 
         rasterCodecs.Options.RasterizeDocument.Load.Unit = fileDataItem.Options.RasterizeDocumentOptions.Unit; 
         rasterCodecs.Options.RasterizeDocument.Load.XResolution = fileDataItem.Options.RasterizeDocumentOptions.XResolution; 
         rasterCodecs.Options.RasterizeDocument.Load.YResolution = fileDataItem.Options.RasterizeDocumentOptions.YResolution; 
         rasterCodecs.Options.RasterizeDocument.Load.SizeMode = fileDataItem.Options.RasterizeDocumentOptions.SizeMode; 
 
         if (fileDataItem.FileInfo.Format == RasterImageFormat.Cmp) 
            rasterCodecs.Options.Jpeg.Load.Multithreaded = openDlg.LoadMultithreaded; 
 
         switch (fileDataItem.Options.FileType) 
         { 
            case RasterDialogFileOptionsType.Meta: 
               { 
                  if (null != fileDataItem.Options.MetaOptions) 
                  { 
                     rasterCodecs.Options.Wmf.Load.XResolution = fileDataItem.Options.MetaOptions.XResolution; 
                     rasterCodecs.Options.Wmf.Load.YResolution = fileDataItem.Options.MetaOptions.XResolution; 
                  } 
                  break; 
               } 
 
            case RasterDialogFileOptionsType.Pdf: 
               { 
                  if ((null != fileDataItem.Options.PdfOptions) && 
                       rasterCodecs.Options.Pdf.IsEngineInstalled) 
                  { 
                     rasterCodecs.Options.Pdf.Load.DisplayDepth = fileDataItem.Options.PdfOptions.DisplayDepth; 
                     rasterCodecs.Options.Pdf.Load.GraphicsAlpha = fileDataItem.Options.PdfOptions.GraphicsAlpha; 
 
                     if (fileDataItem.Options.PdfOptions.Password != null) 
                     { 
                        rasterCodecs.Options.Pdf.Load.Password = fileDataItem.Options.PdfOptions.Password; 
                     } 
 
                     rasterCodecs.Options.Pdf.Load.TextAlpha = fileDataItem.Options.PdfOptions.TextAlpha; 
                     rasterCodecs.Options.Pdf.Load.UseLibFonts = fileDataItem.Options.PdfOptions.UseLibFonts; 
                  } 
                  break; 
               } 
 
            case RasterDialogFileOptionsType.Misc: 
               { 
                  if (null == fileDataItem.Options.MiscOptions) 
                  { 
                     continue; 
                  } 
 
                  switch (fileDataItem.FileInfo.Format) 
                  { 
                     case RasterImageFormat.Jbig: 
                        { 
                           rasterCodecs.Options.Jbig.Load.Resolution = new LeadSize(fileDataItem.Options.MiscOptions.XResolution, 
                              fileDataItem.Options.MiscOptions.YResolution); 
                           break; 
                        } 
 
                     case RasterImageFormat.Cmw: 
                        { 
                           rasterCodecs.Options.Jpeg2000.Load.CmwResolution = new LeadSize(fileDataItem.Options.MiscOptions.XResolution, 
                              fileDataItem.Options.MiscOptions.YResolution); 
                           break; 
                        } 
 
                     case RasterImageFormat.Jp2: 
                        { 
                           rasterCodecs.Options.Jpeg2000.Load.Jp2Resolution = new LeadSize(fileDataItem.Options.MiscOptions.XResolution, 
                              fileDataItem.Options.MiscOptions.YResolution); 
                           break; 
                        } 
 
                     case RasterImageFormat.J2k: 
                        { 
                           rasterCodecs.Options.Jpeg2000.Load.J2kResolution = new LeadSize(fileDataItem.Options.MiscOptions.XResolution, 
                              fileDataItem.Options.MiscOptions.YResolution); 
                           break; 
                        } 
                  } 
                  break; 
               } 
 
            case RasterDialogFileOptionsType.Xls: 
               rasterCodecs.Options.Xls.Load.MultiPageSheet = fileDataItem.Options.XlsOptions.MultiPageSheet; 
               rasterCodecs.Options.Xls.Load.MultiPageEnableMargins = fileDataItem.Options.XlsOptions.MultiPageEnableMargins; 
               rasterCodecs.Options.Xls.Load.MultiPageUseSheetWidth = fileDataItem.Options.XlsOptions.MultiPageUseSheetWidth; 
               rasterCodecs.Options.Xls.Load.PageOrderDownThenOver = fileDataItem.Options.XlsOptions.PageOrderDownThenOver; 
               rasterCodecs.Options.Xls.Load.ShowHiddenSheet = fileDataItem.Options.XlsOptions.ShowHiddenSheet; 
               break; 
 
            case RasterDialogFileOptionsType.Vff: 
               rasterCodecs.Options.Vff.Load.View = fileDataItem.Options.VffOptions.View; 
               break; 
 
            case RasterDialogFileOptionsType.Anz: 
               rasterCodecs.Options.Anz.Load.View = fileDataItem.Options.AnzOptions.View; 
               break; 
 
            case RasterDialogFileOptionsType.Vector: 
               rasterCodecs.Options.Vector.Load.BackgroundColor = fileDataItem.Options.VectorOptions.Options.BackgroundColor; 
               rasterCodecs.Options.Vector.Load.BitsPerPixel = fileDataItem.Options.VectorOptions.Options.BitsPerPixel; 
               rasterCodecs.Options.Vector.Load.ForceBackgroundColor = fileDataItem.Options.VectorOptions.Options.ForceBackgroundColor; 
               rasterCodecs.Options.Vector.Load.ViewHeight = fileDataItem.Options.VectorOptions.Options.ViewHeight; 
               rasterCodecs.Options.Vector.Load.ViewMode = fileDataItem.Options.VectorOptions.Options.ViewMode; 
               rasterCodecs.Options.Vector.Load.ViewWidth = fileDataItem.Options.VectorOptions.Options.ViewWidth; 
               break; 
         } 
 
         rasterCodecs.Options.Load.Passes = fileDataItem.Passes; 
         rasterCodecs.Options.Load.Rotated = fileDataItem.LoadRotated; 
         rasterCodecs.Options.Load.Compressed = fileDataItem.LoadCompressed; 
 
         RasterImage loadedImage = rasterCodecs.Load(fileDataItem.Name, 
            0, 
            CodecsLoadByteOrder.BgrOrGray, 
            fileDataItem.PageNumber, 
            fileDataItem.PageNumber); 
 
         // COPY THE 'loadedImage' IMAGE. 
 
         loadedImage.Dispose(); 
      } 
   } 
} 
public void openDlg_Help(object sender, RasterDialogHelpEventArgs e) 
{ 
   switch (e.Dialog) 
   { 
      case RasterDialogHelpName.Open: 
         { 
            MessageBox.Show("Open dialog Help"); 
            break; 
         } 
 
      case RasterDialogHelpName.LoadOptions: 
         { 
            MessageBox.Show("Load Options dialog Help"); 
            break; 
         } 
   } 
} 
 
public void openDlg_LoadProgress(object sender, RasterDialogLoadProgressEventArgs e) 
{ 
   string displayText; 
 
   displayText = e.FilePercent.ToString() + "% of (" + e.LoadRasterFileData.Name + ") file is loaded"; 
   MessageBox.Show(displayText); 
 
   displayText = e.TotalPercent.ToString() + "% of all file(s) loading process is completed"; 
   MessageBox.Show(displayText); 
   e.Cancel = false; //set this property to true to abort 
} 
 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.7.20
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.WinForms.CommonDialogs.File Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.