打开文件夹
private void buttonX2_Click(object sender, EventArgs e){//输出文件路径FolderBrowserDialog dialog = new FolderBrowserDialog();//提示用户打开文件窗体dialog.Description = "请选择文件路径";if (dialog.ShowDialog() == DialogResult.OK){textBoxsave.Text = dialog.SelectedPath;}}
打开文件
private void buttonX2_Click(object sender, EventArgs e){//输出文件路径SaveFileDialog fileDialog = new SaveFileDialog();//提示用户打开文件窗体fileDialog.Title = "选择输出路径";//文件对话框标题fileDialog.Filter = "栅格数据(*.tiff;*.tif;*.jpep;*.jpg;*.png;*.bmp)|*.tiff;*.tif;*.jpep;*.jpg;*.png;*.bmp";//文件格式筛选字符串if (fileDialog.ShowDialog() == DialogResult.OK)//判断对话框返回值,点击打开{textBoxsave.Text = fileDialog.FileName.ToString(); //显示路径}}