FileDialog 類別

定義

抽象基底類別,其中封裝檔案對話方塊 (包括 OpenFileDialogSaveFileDialog) 的通用功能。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 abstract class FileDialog : Microsoft.Win32.CommonDialog
type FileDialog = class
    inherit CommonDialog
Public MustInherit Class FileDialog
Inherits CommonDialog
繼承
FileDialog
衍生

建構函式

FileDialog()

初始化 FileDialog 類別的新執行個體。Initializes a new instance of the FileDialog class.

屬性

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.

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.

CustomPlaces

取得或設定檔案對話方塊的自訂位置清單。Gets or sets the list of custom places for file dialog boxes.

DefaultExt

取得或設定值,指定用來篩選所顯示之檔案清單的預設副檔名字串。Gets or sets a value that specifies the default extension string to use to filter the list of files that are displayed.

DereferenceLinks

取得或設定值,指出檔案對話方塊會傳回捷徑所參照的檔案位置,還是傳回捷徑檔 (.lnk) 的位置。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).

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

取得或設定篩選條件字串,可決定在 OpenFileDialogSaveFileDialog 中顯示的檔案類型。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.

Options

取得檔案對話方塊用於初始設定的 Win32Win32 通用檔案對話方塊旗標。Gets the Win32Win32 common file dialog flags that are used by file dialogs for initialization.

RestoreDirectory

這個屬性未實作。This property is not implemented.

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.

Tag

取得或設定與對話方塊關聯的物件。Gets or sets an object associated with the dialog. 這可提供將抽象物件附加至對話方塊的能力。This provides the ability to attach an arbitrary object to the dialog.

(繼承來源 CommonDialog)
Title

取得或設定顯示在檔案對話方塊標題列中的文字。Gets or sets the text that appears in the title bar of a file dialog.

ValidateNames

取得或設定值,指出對話方塊是否只接受有效的 Win32Win32 檔名。Gets or sets a value indicating whether the dialog accepts only valid Win32Win32 file names.

方法

CheckPermissionsToShowDialog()

判斷是否有足夠的權限可以顯示對話方塊。Determines whether sufficient permissions for displaying a dialog exist.

(繼承來源 CommonDialog)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
HookProc(IntPtr, Int32, IntPtr, IntPtr)

定義為了將通用功能加入檔案對話方塊中,而覆寫的通用檔案對話方塊攔截程序 (Hook Procedure)。Defines the common file dialog hook procedure that is overridden to add common functionality to a file dialog.

MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
OnFileOk(CancelEventArgs)

引發 FileOk 事件。Raises the FileOk event.

Reset()

將檔案對話方塊的所有屬性設回其初始值。Sets all properties of a file dialog back to their initial values.

RunDialog(IntPtr)

呼叫 RunDialog(IntPtr) 以顯示衍生類別 (Derived Class) 中的檔案對話方塊,例如 OpenFileDialogSaveFileDialogRunDialog(IntPtr) is called to display a file dialog in a derived class, such as OpenFileDialog and SaveFileDialog.

ShowDialog()

顯示通用對話方塊。Displays a common dialog.

(繼承來源 CommonDialog)
ShowDialog(Window)

顯示通用對話方塊。Displays a common dialog.

(繼承來源 CommonDialog)
ToString()

傳回表示檔案對話方塊的字串。Returns a string that represents a file dialog.

事件

FileOk

當使用者按一下 OpenFileDialog 的 [開啟] 按鈕或 SaveFileDialog 的 [儲存] 按鈕來選取檔案名稱時發生。Occurs when the user selects a file name by either clicking the Open button of the OpenFileDialog or the Save button of the SaveFileDialog.

適用於