共用方式為


FileDialog.Title 屬性

定義

取得或設定檔案對話框標題。

public:
 property System::String ^ Title { System::String ^ get(); void set(System::String ^ value); };
public string Title { get; set; }
member this.Title : string with get, set
Public Property Title As String

屬性值

檔案對話框標題。 預設值是空字串 ("")。

範例

以下程式碼範例示範初始化 、 OpenFileDialog設定 TitleFilter 屬性,並允許使用者透過將屬性設 OpenFileDialog.Multiselect 為 true,選擇多個檔案。 執行此範例時,將以下程式碼貼上包含 OpenFileDialog named OpenFileDialog1ButtonfileButton的表單。 在表單的建構子或Load方法中呼叫該InitializeOpenFileDialog方法。 範例中也要求 Click 控制項的事件 Button 與範例中定義的事件處理程序相連結。

void InitializeOpenFileDialog()
{
   this->OpenFileDialog1 = gcnew System::Windows::Forms::OpenFileDialog;
   
   // Set the file dialog to filter for graphics files.
   this->OpenFileDialog1->Filter =
      "Images (*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|" +
      "All files (*.*)|*.*";
   
   // Allow the user to select multiple images.
   this->OpenFileDialog1->Multiselect = true;
   this->OpenFileDialog1->Title = "My Image Browser";
}

void fileButton_Click( System::Object^ sender, System::EventArgs^ e )
{
   OpenFileDialog1->ShowDialog();
}
private void InitializeOpenFileDialog()
{
    this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();

    // Set the file dialog to filter for graphics files.
    this.openFileDialog1.Filter = 
        "Images (*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|" + 
        "All files (*.*)|*.*";

    // Allow the user to select multiple images.
    this.openFileDialog1.Multiselect = true;
    this.openFileDialog1.Title = "My Image Browser";
}

private void fileButton_Click(System.Object sender, System.EventArgs e)
{
    openFileDialog1.ShowDialog();
}
Private Sub InitializeOpenFileDialog()
    Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog

    ' Set the file dialog to filter for graphics files.
    Me.OpenFileDialog1.Filter = _
    "Images (*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*"

    ' Allow the user to select multiple images.
    Me.OpenFileDialog1.Multiselect = True
    Me.OpenFileDialog1.Title = "My Image Browser"
End Sub

Private Sub fileButton_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles FileButton.Click
    OpenFileDialog1.ShowDialog()
End Sub

備註

字串會被放置在對話框的標題欄中。 如果標題是空字串,系統會使用預設標題,要麼是「另存為」或「開啟」。

適用於