FileDialog.Title Właściwość
Definicja
Pobiera lub ustawia tytuł okna dialogowego pliku.Gets or sets the file dialog box 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
Wartość właściwości
Tytuł okna dialogowego plik.The file dialog box title. Wartością domyślną jest ciąg pusty ("").The default value is an empty string ("").
Przykłady
Poniższy przykład kodu demonstruje inicjowanie OpenFileDialog , ustawienie Title Filter właściwości i Zezwalanie użytkownikowi na wybranie wielu plików przez ustawienie OpenFileDialog.Multiselect właściwości na true.The following code example demonstrates initializing an OpenFileDialog, setting the Title and Filter properties, and allowing the user to select multiple files by setting the OpenFileDialog.Multiselect property to true. Aby uruchomić ten przykład, wklej następujący kod w postaci zawierającej OpenFileDialog nazwę OpenFileDialog1
i Button nazwę fileButton
.To run this example, paste the following code in a form containing an OpenFileDialog named OpenFileDialog1
and a Button named fileButton
. Wywołaj InitializeOpenFileDialog
metodę w konstruktorze lub Load
metodzie formularza.Call the InitializeOpenFileDialog
method in the form's constructor or Load
method. Przykład wymaga również, aby Click
zdarzenie Button
kontrolki zostało połączone z programem obsługi zdarzeń zdefiniowanym w przykładzie.The example also requires that the Click
event of the Button
control is connected to the event handler defined in the example.
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
Uwagi
Ciąg zostanie umieszczony na pasku tytułu okna dialogowego.The string is placed in the title bar of the dialog box. Jeśli tytuł jest pustym ciągiem, system używa domyślnego tytułu, czyli "Save as" lub "Open".If the title is an empty string, the system uses a default title, which is either "Save As" or "Open".