• Winform动态加载TabControl用法


    private void BindTabData()
            {
                dtIPD = new DataTable();
                //drItem = new DataTable();
                //获取【项目大类】列表显示于 TabPage
                MRD_Score model = new MRD_Score();
                model.ActiveFlag = "Y";
                DataTable dtScore = fmed.GetScoreType(model);
                foreach (DataRow dr in dtScore.Rows)
                {
                    MRD_Score sr = new MRD_Score();
                    sr.PCode = dr["ProCode"].ToString();
    
                    TabPage tabpage = new System.Windows.Forms.TabPage(dr["ProName"].ToString().Trim());
                    tabpage.Name = dr["ProName"].ToString().Trim();
                    tabpage.AutoScroll = true;
                    tabpage.Text = dr["ProName"].ToString().Trim();
                    //获取大类下的 缺陷项目列表  txtIPD_NO.Text.Trim()
                   DataTable  drItem = fmed.getScoreItemType(sr.PCode, "");
                    drItem.Columns.Add("缺陷数", Type.GetType("System.Int32"));
                    drItem.Columns.Add("已审核", Type.GetType("System.Int32"));
                    drItem.Columns.Add("评分时间", Type.GetType("System.String"));
                    drItem.Columns.Add("评分人", Type.GetType("System.String"));
                    drItem.Columns.Add("审核时间", Type.GetType("System.String"));
                    drItem.Columns.Add("审核人", Type.GetType("System.String"));
                    DataGridView dgv = new DataGridView();
                    dgv.AllowUserToAddRows = false;//禁用新增
                    dgv.AllowUserToDeleteRows = false; //禁用删除
                    dgv.Width = 960;
                    dgv.Height = 600;
                    dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
    
                    dgv.CellValidating += new DataGridViewCellValidatingEventHandler(dgv_CellValidating);//验证是否为数字
                    dgv.CellBeginEdit += new DataGridViewCellCancelEventHandler(dgv_CellBeginEdit);// 设置 是否可以编辑
                    dgv.CellEndEdit += new DataGridViewCellEventHandler(dgv_CellEndEdit);
                    //dgv.CellFormatting += new DataGridViewCellFormattingEventHandler(dgv_CellFormatting);
                    dgv.DataSource = drItem;
                    dtIPD = fmed.getScoreItemType(sr.PCode, txtIPD_NO.Text.Trim());
                    tabpage.Controls.Add(dgv);
                    this.tabControl1.Controls.Add(tabpage);
                    SetInputValue(dgv, dtIPD);//加载已经输入的分值
                    total += getDeFen(dgv, dtIPD);
    
                    dgv.Columns["PCode"].Visible = false;
                    dgv.Columns["ItemCode"].Visible = false;
                    dgv.Columns["评分人"].Visible = false;
                    dgv.Columns["审核人"].Visible = false;
                }
            }
     1 private void GetTolSum()
     2         {
     3             if (tabControl1.TabCount == 0)
     4             {
     5                 txtScore.Clear();
     6                 txtLevel.Clear();
     7                 return;
     8             }
     9             double tolsource = 0.00;
    10             for (int i = 0; i < tabControl1.TabCount; i++)
    11             {
    12                 if (!tabControl1.TabPages[i].HasChildren)
    13                 {
    14                     continue;
    15                 }
    16                 tolsource += SumDgv((DataGridView)tabControl1.TabPages[i].Controls[0]);
    17             }
    18             GetScoreLevel(tolsource);
    19             SaveTol();
    20 
    21         }
  • 相关阅读:
    Gitlab_ansible_jenkins三剑客⑥Jenkins和ansible集成
    Gitlab_ansible_jenkins三剑客⑤jenkins Pipeline-job的使用
    Gitlab_ansible_jenkins三剑客④jenkins安装图解及freestyle的简单使用
    Gitlab_ansible_jenkins三剑客③Ansible的安装及使用
    Gitlab_ansible_jenkins三剑客②Gitlab的后台管理
    Gitlab_ansible_jenkins三剑客①搭建gitlab的详细步骤
    windows2012服务器中安装php7+mysql5.7+apache2.4环境
    07binlog日志介绍
    open()系统调用的实现
    文件系统中的目录查找
  • 原文地址:https://www.cnblogs.com/yexiaoyanzi/p/4092880.html
Copyright © 2020-2023  润新知