C# 选择文件夹目录

 using var dialog = new FolderBrowserDialog
 {
     Description = $"选择 Ljt.WinFormsWms 的安装目录(含 {UpdateTarget.MainExecutableName})",
     UseDescriptionForTitle = true,
 };

 if (Directory.Exists(txtInstallDir.Text.Trim())) dialog.SelectedPath = txtInstallDir.Text.Trim();
 if (dialog.ShowDialog(this) != DialogResult.OK) return;

 txtInstallDir.Text = dialog.SelectedPath;
 ProbeTarget(fillBaseUrl: true);
posted @ 2026-10-29 12:35  LuoCore  阅读(5)  评论(0)    收藏  举报