编程语言
首页 > 编程语言> > c#winform中选择目录对话框

c#winform中选择目录对话框

作者:互联网

private void button2_Click(object sender, EventArgs e)
{
    FolderBrowserDialog dlg = new FolderBrowserDialog();
    dlg.SelectedPath = Path.GetFullPath(".");
    if (dlg.ShowDialog() == DialogResult.OK)
    {
        string path = dlg.SelectedPath;
        MessageBox.Show("选中了:" + path);
    }
}

标签:dlg,对话框,c#,FolderBrowserDialog,private,path,SelectedPath,winform
来源: https://blog.csdn.net/csdnwyf/article/details/119329223