Qml

Wpfファイルを開くダイアログ、ファイルを保存するダイアログ、フォルダを選択するダイアログ



Wpf Open File Dialog



ファイルダイアログを開く、Microsoft.Win32メソッドを使用してファイルダイアログを保存する
System.Windows.Formsメソッドを使用するには、フォルダーダイアログを選択します

ファイルを開くダイアログ

/ / Create a dialog to open a file Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog() Filter = 'All Files / / call the ShowDialog () method to display the dialog box, the return value of the method represents whether the user clicked the OK button if (dialog.ShowDialog().GetValueOrDefault()) { Text = dialog.FileName } else { //Todo }

ファイルの保存ダイアログ

/ / Create a dialog to save the file Microsoft.Win32.SaveFileDialog dialog = new Microsoft.Win32.SaveFileDialog() *.*' InitialDirectory = @'D:' / / call the ShowDialog () method to display the dialog box, the return value of the method represents whether the user clicked the OK button if (dialog.ShowDialog().GetValueOrDefault()) { Text = dialog.FileName } else { //Todo }

フォルダの選択ダイアログ

/ / Create a dialog box to select a folder System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog() / / call the ShowDialog () method to display the dialog box, the return value of the method represents whether the user clicked the OK button if (dialog.ShowDialog()!=System.Windows.Forms.DialogResult.Cancel) { Text = dialog.SelectedPath.Trim() } else { //Todo }