private void BtnSelectDir_Click(object sender, EventArgs e) { string dir = this.SelectedDir.Text; if (this.Dirじゃなくて読み込みファイル) { string file = dir; file = SaveLoadDialogs.LoadFile( this.DirKindTitle + "を選択して下さい。", "", file == "" ? Environment.GetFolderPath(Environment.SpecialFolder.Desktop) : Path.GetDirectoryName(file), file == "" ? this.File_InitialFile : Path.GetFileName(file), dlg => dlg.Filter = this.File_Filter ); if (file != null) { this.SelectedDir.Text = file; } } else { if (SaveLoadDialogs.SelectFolder(ref dir, this.DirKindTitle + "を選択して下さい。")) { this.SelectedDir.Text = dir; } } }
public static void ChooseFolder(Form parent, TextBox tb, bool newFolderOk = true) { string dir = tb.Text; if (dir == "" || Directory.Exists(dir) == false) { dir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); } if (SaveLoadDialogs.SelectFolder(ref dir, "フォルダを指定してください。")) { tb.Text = dir; } }
private void chooseFFmpegDir() { string description = "ffmpeg のパスを指定してください。\n例) C:\\app\\ffmpeg-3.2.4-win64-shared"; if (Environment.Is64BitOperatingSystem == false) // ? OS == 32-bit { description = description.Replace("64", "32"); } if (SaveLoadDialogs.SelectFolder(ref Gnd.i.ffmpegDir, description, dlg => { dlg.RootFolder = Environment.SpecialFolder.MyComputer; dlg.ShowNewFolderButton = false; } )) { Gnd.i.ffmpegDir = FileTools.toFullPath(Gnd.i.ffmpegDir); } }