Пример #1
0
        private void button_selectResult_Click(object sender, EventArgs e)
        {
            CustomizedFolderBrowserDialog dialog = new CustomizedFolderBrowserDialog();

            dialog.Title = "请选择存放word结果文件的文件夹";
            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                textBox_result.Text = "";
                textBox_result.Text = dialog.SelectedPath;
                Properties.Settings.Default.resultFolder = textBox_result.Text;
                Properties.Settings.Default.Save();
            }
        }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            CustomizedFolderBrowserDialog browser = new CustomizedFolderBrowserDialog();

            if (value != null)
            {
                browser.SelectedPath = string.Format("{0}", value);
            }
            if (browser.ShowDialog(null) == DialogResult.OK)
            {
                return(browser.SelectedPath);
            }
            return(value);
        }