Bewerken

Delen via


FileDialog Class

Definition

An abstract base class that encapsulates functionality that is common to file dialogs, including OpenFileDialog and SaveFileDialog.

public ref class FileDialog abstract : Microsoft::Win32::CommonDialog
public ref class FileDialog abstract : Microsoft::Win32::CommonItemDialog
public abstract class FileDialog : Microsoft.Win32.CommonDialog
public abstract class FileDialog : Microsoft.Win32.CommonItemDialog
type FileDialog = class
    inherit CommonDialog
type FileDialog = class
    inherit CommonItemDialog
Public MustInherit Class FileDialog
Inherits CommonDialog
Public MustInherit Class FileDialog
Inherits CommonItemDialog
Inheritance
FileDialog
Inheritance
Derived

Constructors

FileDialog()

Initializes a new instance of the FileDialog class.

Properties

AddExtension

Gets or sets a value indicating whether a file dialog automatically adds an extension to a file name if the user omits an extension.

AddToRecent

Gets or sets a value indicating whether the dialog box will add the item being opened or saved to the recent documents list.

(Inherited from CommonItemDialog)
CheckFileExists

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

CheckPathExists

Gets or sets a value that specifies whether warnings are displayed if the user types invalid paths and file names.

ClientGuid

Gets or sets a GUID to associate with the dialog's persisted state.

(Inherited from CommonItemDialog)
CustomPlaces

Gets or sets the list of custom places for file dialog boxes.

CustomPlaces (Inherited from CommonItemDialog)
DefaultDirectory

Gets or sets the directory displayed by the file dialog box if no recently used directory value is available.

(Inherited from CommonItemDialog)
DefaultExt

Gets or sets a value that specifies the default extension string to use to filter the list of files that are displayed.

DereferenceLinks

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

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).

(Inherited from CommonItemDialog)
FileName

Gets or sets a string containing the full path of the file selected in a file dialog.

FileNames

Gets an array that contains one file name for each selected file.

Filter

Gets or sets the filter string that determines what types of files are displayed from either the OpenFileDialog or SaveFileDialog.

FilterIndex

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

InitialDirectory

Gets or sets the initial directory that is displayed by a file dialog.

InitialDirectory

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

(Inherited from CommonItemDialog)
Options

Gets the Win32 common file dialog flags that are used by file dialogs for initialization.

RestoreDirectory

This property is not implemented.

RootDirectory

Gets or sets the directory displayed as the navigation root for the dialog.

(Inherited from CommonItemDialog)
SafeFileName

Gets a string that only contains the file name for the selected file.

SafeFileNames

Gets an array that contains one safe file name for each selected file.

ShowHiddenItems

Gets or sets a value indicating whether the dialog box will show hidden and system items regardless of user preferences.

(Inherited from CommonItemDialog)
Tag

Gets or sets an object associated with the dialog. This provides the ability to attach an arbitrary object to the dialog.

(Inherited from CommonDialog)
Title

Gets or sets the text that appears in the title bar of a file dialog.

Title

Gets or sets the text shown in the title bar of the file dialog.

(Inherited from CommonItemDialog)
ValidateNames

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

ValidateNames

Gets or sets a value indicating whether to check for situations that would prevent an application from opening the selected file, such as sharing violations or access denied errors.

(Inherited from CommonItemDialog)

Methods

CheckPermissionsToShowDialog()

Determines whether sufficient permissions for displaying a dialog exist.

(Inherited from CommonDialog)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
HookProc(IntPtr, Int32, IntPtr, IntPtr)

Defines the common file dialog hook procedure that is overridden to add common functionality to a file dialog.

HookProc(IntPtr, Int32, IntPtr, IntPtr)

Defines the common dialog box hook procedure that is overridden to add specific functionality to a common dialog box.

(Inherited from CommonDialog)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnFileOk(CancelEventArgs)

Raises the FileOk event.

OnItemOk(CancelEventArgs)

Raises the FileOk event.

Reset()

Sets all properties of a file dialog back to their initial values.

RunDialog(IntPtr)

RunDialog(IntPtr) is called to display a file dialog in a derived class, such as OpenFileDialog and SaveFileDialog.

RunDialog(IntPtr)

Performs initialization work in preparation to show a file open, file save, or folder open dialog box.

(Inherited from CommonItemDialog)
ShowDialog()

Displays a common dialog.

(Inherited from CommonDialog)
ShowDialog(Window)

Displays a common dialog.

(Inherited from CommonDialog)
ToString()

Returns a string that represents a file dialog.

Events

FileOk

Occurs when the user selects a file name by either clicking the Open button of the OpenFileDialog or the Save button of the SaveFileDialog.

Applies to