How to use

Components have NeedRepaintPreview event that occurs when selection in list view box is changed. In that way you can define some lines of code to show image in preview box:

 
private void imageOpenDialog_NeedRepaintPreview(object sender, PreviewDialogs.PreviewEventArgs args)
{
	try
	{
		string ext = System.IO.Path.GetExtension( args.Path ).ToLower();
		switch(ext)
		{
			case ".hpr"://your custom image file format
				args.Preview = MyCodec.FromFile( args.Path );
			break;
			case ".pcx":
				args.Preview = Images.PCXCodec.FromFile( args.Path );
			break;
			case ".tga":
				args.Preview = Images.TGACodec.FromFile( args.Path );
			break;
			default://other image files(standard .net support images)
				try
				{
					args.Preview = Image.FromFile( args.Path );
				}
				catch
				{
					args.Preview = null;
				}
				break;
			}
		}
		catch
		{
			args.Preview = null;
		}
}	 

Public Propereties

CheckFileExists

Overridden. Gets or sets a value indicating whether the dialog box displays a warning if the user specifies a file name that does not exist.

CheckPathExists

Gets or sets a value indicating whether the dialog box displays a warning if the user specifies a path that does not exist.

Container (inherited from Component)

Gets the IContainer that contains the Component.

DefaultExt

Gets or sets the default file name extension.

DereferenceLinks

Gets or sets a value indicating whether the dialog box returns the location of the file referenced by the shortcut or whether it returns the location of the shortcut (.lnk).

FileName

Gets or sets a string containing the file name selected in the file dialog box.

FileNames

Gets the file names of all selected files in the dialog box.

Filter

Gets or sets the current file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box.

FilterIndex

Gets or sets the index of the filter currently selected in the file dialog box.

InitialDirectory

Gets or sets the initial directory displayed by the file dialog box.

MultiSelect

Gets or sets a value indicating whether the dialog box allows multiple files to be selected.

PreviewButtonIcon

Gets or sets icon that displayed on the preview button of dialog box.

ReadOnlyCheked

Gets or sets a value indicating whether the read-only check box is selected.

RestoreDirectory

Gets or sets a value indicating whether the dialog box restores the current directory before closing.

ShowHelp

Gets or sets a value indicating whether the Help button is displayed in the file dialog.

ShowPreviewButton

Gets or sets a value indicating whether the dialog box contains a preview button.

ShowReadOnly

Gets or sets a value indicating whether the dialog box contains a read-only check box.

Site

Gets or sets the ISite of the Component.

StandartImagesRepaint

Indicates when preview box show images for standard formats(*.jpg, *.png, *.gif, *.tif, *.bmp, *.emf, *.wmf) without calling NeedRepaintPreview event.

Title

Gets or sets the file dialog box title.

ValidateNames

Gets or sets a value indicating whether the dialog box accepts only valid Win32 file names.

Public Methods

CreateObjRef (inherited from MarshalByRefObject)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. See System.MarshalByRefObject reference for details.

Dispose (inherited from Component)

Overloaded. Releases the resources used by the Component. See System.ComponentModel.Component reference for details.

Equals (inherited from Object)

Overloaded. Determines whether two Object instances are equal. See System.Object reference for details.

GetHashCode (inherited from Object)

Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table. See System.Object reference for details.

GetLifetimeService(inherited from MarshalByRefObject)

Retrieves the current lifetime service object that controls the lifetime policy for this instance. See System.MarshalByRefObject reference for details.

InitializeLifetimeService (inherited from MarshalByRefObject)

Obtains a lifetime service object to control the lifetime policy for this instance. See System.MarshalByRefObject reference for details.

ShowDialog

Runs a common dialog box.

ToString (inherited from Object)

Returns a String that represents the current Object. See System.Object reference for details.

Public Events

Disposed (inherited from Component)

Adds an event handler to listen to the Disposed event on the component. See System.ComponentModel.Component reference for details.

FileOk

Occurs when the user clicks on the Open or Save button on a file dialog box.

FolderChanged

Occurs when currently selected folder has changed.

HelpRequest

Occurs when the user clicks the Help button on a common dialog box.

NeedRepaintPreview

Occurs when selected file is changed and need repaint a preview box.

Protected properties

DesignMode(inherited from Component)

Gets a value that indicates whether the Component is currently in design mode. See System.ComponentModel.Component reference for details.

Events(inherited from Component)

Gets the list of event handlers that are attached to this Component. See System.ComponentModel.Component reference for details.


© 2006 MarablaSoft. All Rights Reserved



Hosted by uCoz