Filter Property

Summary
Gets or sets the current file name filters array, which determines the choices that appear in the "Files of type" box in the dialog box.
Syntax
C#
C++/CLI
public RasterOpenDialogLoadFormat[] Filter { get; set; } 
public: 
property array<RasterOpenDialogLoadFormat>^ Filter { 
   array<RasterOpenDialogLoadFormat>^ get(); 
   void set (    array<RasterOpenDialogLoadFormat>^ value); 
} 

Property Value

The file filtering options available in the dialog box. If the Filter is empty the dialog will use the LEADTOOLS default filters.

Remarks

The default filter list includes:

  • "All Files (*.*)"
  • "LEAD (*.cmp)"
  • "Jpeg (*.jpg;*.jpeg;*.jtf)"
  • "Cmw (*.cmw)"
  • "Jpeg 2000 (*.j2k;*.jp2)"
  • "Tiff (*.tif;*.tiff)"
  • "Gif (*.gif)"
  • "Png (*.png)"
  • "Portable Document Format (*.pdf)"
  • "Adaptive bi-level image compression (*.abic)"
  • "Adobe Photoshop (*.psd)"
  • "Advanced Function Presentation (*.afp)"
  • "Animated Cursor (*.ani)"
  • "Cals (*.cal)"
  • "Canon Raw Format (*.crw)" (Note: this filter not available in x64 platform)
  • "Clipboard (*.clp)"
  • "Cut (*.cut)"
  • "DICOM (*.dic)"
  • "Djvu (*.djv)" Deprecated - No longer supported.
  • "Enhanced Metafile (*.emf)"
  • "Exif (*.exf;*.tif;*.jpg)"
  • "Fax (*.fax)"
  • "Flic (*.flc;*.fli)"
  • "FlashPix (*.fpx)"
  • "Flexible Image Transport System) (*.fit)"
  • "Gem Img (*.img)"
  • "Iff (*.iff)"
  • "Internet Fax (*.tifx;*.tiff;*.tfx)"
  • "Ioca (*.ica)"
  • "Itg (*.itg;*.cit)"
  • "Jbig (*.jbg;*.jbig)"
  • "Jbig2 (*.jb2)"
  • "Kodak Cineon (*.cin)"
  • "Kodak Digital Camera Kdc (*.kdc)" (Note: this filter not available in x64 platform)
  • "Kodak Photo CD (*.pcd)" (Note: this filter not available in x64 platform)
  • "Kodak Professional Digital Camera System (*.tif;*.tiff)"
  • "LaserView (*.lv)"
  • "MacPaint (*.mac)"
  • "Mac Pict (*.pct;*.pict)"
  • "Modca (*.ica)"
  • "MS Fax (*.awd)" (Note: this filter not available in x64 platform)
  • "MS Paint (*.msp)"
  • "Mo:dca Ptoca (*.ptk)"
  • "NAP format (vector) (*.nap)"
  • "Os/2 Bitmap (*.bmp)"
  • "PaintBrush Pcx (*.pcx)"
  • "Pbm (*.pbm)"
  • "Pgm (*.pgm)"
  • "Postscript (*.eps)"
  • "Ppm (*.ppm)"
  • "Profession Digital Camera (*.dcr)" (Note: this filter not available in x64 platform)
  • "Profession Digital Camera (*.tif;*.tiff)"
  • "Rich Text Format (*.rtf)"
  • "Scitex Continuous Tone (*.sct; *.ct)"
  • "Sgi (*.sgi)"
  • "Structured Fax File (*.sff)"
  • "Sun Raster (*.ras)"
  • "Targa Tga (*.tga)"
  • "Text format (*.txt)"
  • "Windows Bitmap (*.bmp)"
  • "Windows Cursor (*.cur)"
  • "Windows Icon (*.ico;*.Icon)"
  • "WinFax (*.wfx)"
  • "Windows Metafile (*.wmf)"
  • "WordPerfect Graphic (*.wpg)"
  • "Wireless Bitmap (*.wbmp)"
  • "Xionics Smp (*.smp)"
  • "XWindows Bitmap (*.xwd)"
  • "X Bitmap (*.xbm)"
  • "X Pixmap (*.xpm)"
Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.WinForms.CommonDialogs.File; 
 
 
public void RasterOpenDialogExample() 
{ 
	RasterCodecs rasterCodecs = new RasterCodecs(); 
 
	RasterOpenDialog openDlg = new RasterOpenDialog(rasterCodecs); 
 
	openDlg.Filter = new RasterOpenDialogLoadFormat[] 
	{ 
	new RasterOpenDialogLoadFormat ( "All Files", "*.*" ), 
	new RasterOpenDialogLoadFormat ( "LEAD", "*.cmp" ) 
	}; 
 
	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; 
 
	// 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; 
 
			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; 
					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); 
} 
 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
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.