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、 プロパティと Filter プロパティをTitle設定し、 プロパティを true に設定することで、ユーザーが複数のファイルを選択できるようにする方法をOpenFileDialog.Multiselect示します。 この例を実行するには、次のコードを、名前付き と という名前OpenFileDialog1fileButtonの をOpenFileDialog含むフォームにButton貼り付けます。 フォームの InitializeOpenFileDialog コンストラクターまたは Load メソッドで メソッドを呼び出します。 この例では、コントロールの イベントが ClickButton この例で定義されているイベント ハンドラーに接続されている必要もあります。

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

注釈

文字列は、ダイアログ ボックスのタイトル バーに配置されます。 タイトルが空の文字列の場合、システムは既定のタイトル ("名前を付けて保存" または "開く" ) を使用します。

適用対象