Click or drag to resize

ShellFilePreview Class

Use this component to display a preview of a file. Depending on the installed PreviewHandlers not all files types support a preview. If no preview is registered, a thumbnail of the file is shown. You may either use the Path property to set a path to a file to load the preview or you may synchronize it to a ShellListView or ShellTreeView component using the ShellControlConnector property.
Inheritance Hierarchy

Namespace:  Jam.Shell
Assembly:  ShellBrowser (in ShellBrowser.dll) Version: 7.1
Syntax
public class ShellFilePreview : Control, 
	IShellControl, IShellControlConnectorTarget, ISupportInitialize, ISupportInitializeNotification, ICommonPreviewHandlerHost

The ShellFilePreview type exposes the following members.

Constructors
  NameDescription
Public methodShellFilePreview
Initialialises a new instance of the ShellFilePreview class.
Top
Properties
  NameDescription
Public propertyAutomaticRefresh
Controls whether the component automatically reloads the preview when the file is changed. "
Public propertyDisplayMsg
Gets or sets a message that is displayed in the component if no preview is currently being displayed.
Public propertyIsInitialized
Indicates whether the component is initialized.
Public propertyCode exampleItemIdList
Gets or sets the absolute ItemIdList that is previewed.
Public propertyNoPreviewAvailableMessage
Gets or sets a message to be displayed if the item to be previewed is not supported.
Public propertyPath
Gets or sets the path of the file that is displayed.
Public propertyPreviewNotPossibleMessage
Gets or sets a message to be displayed if loading the preview failed.
Public propertySelectFileMessage
Gets or sets a message to be displayed when no item is active.
Public propertyShellControlConnector
ShellControlConnector for this class. Set this property to the same ShellControlConnector instance of a ShellListView, ShellTreeView or ShellSystemList to keep the ShellFilePreview in sync with these components. It will then always preview the selected file.
Public propertyVersion
The current version of the ShellBrowser.
Top
Methods
  NameDescription
Public methodBeginInit
Signals the object that initialization is starting.
Public methodClear
Clears the preview
Protected methodDispose
Disposal method for the object that also cleans up resources that are used.
(Overrides ControlDispose(Boolean).)
Public methodEndInit
Signals the object that initialization is complete.
Public methodFolderChanged
Called by ShellControlConnector when the current folder has changed.
Public methodFullRefresh
Forces the reload of the current file.
Public methodGetDisplayRect
Gets display rectangle.
Public methodGetSynchronizationContext
PreviewHost must provide its SynchronizationContext to be used by async events.
Public methodGetWindowHandle
Gets window handle.
Public methodGoUp
Not supported.
Protected methodOnAfterPreviewLoaded
Calls the AfterPreviewLoaded event.
Public methodOnCommonPreviewHandlerLoaded
Controls implementing this interface must implement this eventhandler, which is called after the preview has been loaded.
Protected methodOnCreateControl (Overrides ControlOnCreateControl.)
Protected methodOnEnabledChanged
While disabled the control only stored the current filename. On enabling a FullRefresh is triggered.
(Overrides ControlOnEnabledChanged(EventArgs).)
Protected methodOnHandleDestroyed
Raises the HandleDestroyed event.
(Overrides ControlOnHandleDestroyed(EventArgs).)
Protected methodOnLoadPreview
Calls the LoadPreview event.
Protected methodOnPaint
Paints the error message text on the ShellFilePreview control.
(Overrides ControlOnPaint(PaintEventArgs).)
Protected methodOnResize
Passes the resize event to the current PreviewHandler
(Overrides ControlOnResize(EventArgs).)
Protected methodOpen
Opens the path that is passed with the matching preview handler.
Public methodRefresh(RefreshLevel)
Refreshes the control.
Public methodRefresh(RefreshLevel, ItemIdList)
Refreshes the control.
Public methodSelectedFileChange
Called by ShellControlConnector when the selected file has changed.
Public methodSmartRefresh
Forces the reload of the current file. There is no difference compared to FullRefresh.
Top
Events
  NameDescription
Public eventAfterPreviewLoaded
Event that occurs after the preview has been loaded.
Public eventInitialized
Occurs when initialization of the component is completed.
Public eventCode exampleLoadPreview
Event is thrown when a file is previewed. It can be implemented to set a custom preview control.
Top
Fields
  NameDescription
Public fieldStatic memberWebPreviewHandler
The GUID of the WebPreviewHandler class.
Top
Extension Methods
  NameDescription
Public Extension MethodHandleNeeded
A Control extension method that ensures that the handle for a control is created.
(Defined by ExtensionMethods.)
Public Extension MethodScaledPixels
An extension method for controls: It scales the passed pixels according to the current dpi the control is displayed with.
(Defined by ExtensionMethods.)
Public Extension MethodScaleFont
A Control extension method that scales font according to the passed factor.
(Defined by ExtensionMethods.)
Top
Remarks
The component is using the Preview Handlers registered in the system to display the files, so that normally the same files that Windows Explorer can preview should be supported. There are occasional problems concerning the bitness of the application using the ShellFilePreview vs. the bitness of the PreviewHandler registered for a filetype. With the LoadPreview event it is also possible to use existing PreviewHandlers to display other file extensions. If you want to preview Microsoft Outlook .msg files and only the header is displayed, make sure to have Visual Styles enabled for your application. Call "Application.EnableVisualStyles()" or change your application manifest accordingly.
See Also