zoukankan      html  css  js  c++  java
  • datagridview只允许单选

            private void dataGridViewTemplate_CellContentClick(object sender, DataGridViewCellEventArgs e)
            {
                if (e.ColumnIndex != 0)
                {
                    string buttonText = this.dataGridViewTemplate.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                    if (buttonText == "预览")
                    {
                        FormTemplatePreview fromTemplatePreview = new FormTemplatePreview(this.dataGridViewTemplate.CurrentRow.Cells[2].Value.ToString(), this.dataGridViewTemplate.CurrentRow.Cells[3].Value.ToString());
                        fromTemplatePreview.Show();
                    }
                    for (int i = 0; i < this.dataGridViewTemplate.Rows.Count; i++)
                    {
                        this.dataGridViewTemplate.Rows[i].Cells[0].Value = false;
                    }
                    this.dataGridViewTemplate.Rows[e.RowIndex].Cells[0].Value = true;
                }
                else
                {
                    for (int i = 0; i < this.dataGridViewTemplate.Rows.Count; i++)
                    {
                        this.dataGridViewTemplate.Rows[i].Cells[0].Value = false;
                    }
                    this.dataGridViewTemplate.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = true;
                }
                
            }
  • 相关阅读:
    L1-012 计算指数
    L1-011 A-B
    L1-010 比较大小
    Django--登录
    Django--跨域设置
    Django--视图装饰器
    Django--URL配置
    Django--多数据库
    Django--channels
    Django--日志
  • 原文地址:https://www.cnblogs.com/maijin/p/2837529.html
Copyright © 2011-2022 走看看