コード例 #1
0
        private void button7_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count < 1)
            {
                MessageBox.Show("请先选择用户组", "错误");
                return;
            }
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Multiselect = true;//该值确定是否可以选择多个文件
            dialog.Title       = "请选择图片";
            dialog.Filter      = "图片文件(*.png;*.jpg;*.bmp)|*.png;*.jpg;*.bmp";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string[] files    = dialog.FileNames;
                var      groupID  = dataGridView1.CurrentRow.Cells[0].Value.ToString();
                string   userName = string.Empty;
                InputName.Show(out userName);
                register(files, groupID, userName);
                updateUserList(groupID);
            }
        }