winform弹出文件和目录选择框

目录选择:

FolderBrowserDialog dialog = new FolderBrowserDialog();
            dialog.Description = "请选择文件路径";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string foldPath = dialog.SelectedPath;
                MessageBox.Show("已选择文件夹:" + foldPath, "选择文件夹提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.textBox1.Text = foldPath;
            }

文件选择:

OpenFileDialog fileDialog = new OpenFileDialog();
fileDialog.Multiselect = true;
fileDialog.Title = "请选择文件";
fileDialog.Filter="所有文件(*.*)|*.*";
if (fileDialog.ShowDialog() == DialogResult.OK)
{
string file=fileDialog.FileName;
MessageBox.Show("已选择文件:" + file,"选择文件提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}

关于绘图:

http://www.cnblogs.com/peterzb/archive/2009/07/27/1532288.html

http://www.cnblogs.com/peterzb/archive/2009/07/19/1526555.html

原文地址:https://www.cnblogs.com/xsj1989/p/7715907.html